summaryrefslogtreecommitdiff
path: root/billing/test/integration/subscription_test.rb
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2013-10-18 00:18:03 -0700
committerazul <azul@riseup.net>2013-10-18 00:18:03 -0700
commit221532448ba4c435427ad2b5b3eca729b352c354 (patch)
tree1caa069380cb075155e97755d3d94d1274b4a9ea /billing/test/integration/subscription_test.rb
parentbf3b59e6807c8e4789b97232c7416093b07cccdf (diff)
parent92cb054d53aaac6864a6a805d9cdd3919f4a38bc (diff)
Merge pull request #98 from jessib/feature/billing-past-due-subscriptions
Feature/billing past due subscriptions
Diffstat (limited to 'billing/test/integration/subscription_test.rb')
-rw-r--r--billing/test/integration/subscription_test.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/billing/test/integration/subscription_test.rb b/billing/test/integration/subscription_test.rb
index b893896..6356177 100644
--- a/billing/test/integration/subscription_test.rb
+++ b/billing/test/integration/subscription_test.rb
@@ -10,28 +10,34 @@ class SubscriptionTest < ActionDispatch::IntegrationTest
setup do
Warden.test_mode!
- @admin = stub_record :user, :admin => true
+ @admin = User.find_by_login('admin') || FactoryGirl.create(:user, login: 'admin')
@customer = stub_customer
@braintree_customer = @customer.braintree_customer
response = Braintree::Subscription.create plan_id: '5',
- payment_method_token: @braintree_customer.credit_cards.first.token
+ payment_method_token: @braintree_customer.credit_cards.first.token,
+ price: '10'
@subscription = response.subscription
Capybara.current_driver = Capybara.javascript_driver
end
teardown do
Warden.test_reset!
+ @admin.destroy
end
- test "admin can see subscription for another" do
+ test "admin can see all subscriptions for another" do
login_as @admin
@customer.stubs(:subscriptions).returns([@subscription])
+ @subscription.stubs(:balance).returns 0
visit user_subscriptions_path(@customer.user_id)
assert page.has_content?("Subscriptions")
assert page.has_content?("Status: Active")
page.save_screenshot('/tmp/subscriptions.png')
end
+ # test "user cannot see all subscriptions for other user" do
+ #end
+
#test "admin cannot add subscription for another" do
#end