summaryrefslogtreecommitdiff
path: root/billing/test/integration
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-09-19 12:07:25 -0700
committerjessib <jessib@riseup.net>2013-09-19 12:07:25 -0700
commit3a2e64c75f67af89ffd78dbf80dd947896d85d22 (patch)
treeea17ee32d763bb875e4814b09ed1f443c112980c /billing/test/integration
parente8a2db42813dc3f5d1ebb95eb896455d7a922505 (diff)
parent890c9e170fc038eccb46eca3c1ddcf6f05eaa53f (diff)
Merge branch 'develop' into feature/only_lower_case_aliases
Diffstat (limited to 'billing/test/integration')
-rw-r--r--billing/test/integration/subscription_test.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/billing/test/integration/subscription_test.rb b/billing/test/integration/subscription_test.rb
new file mode 100644
index 0000000..b893896
--- /dev/null
+++ b/billing/test/integration/subscription_test.rb
@@ -0,0 +1,50 @@
+require 'test_helper'
+require 'fake_braintree'
+require 'capybara/rails'
+
+class SubscriptionTest < ActionDispatch::IntegrationTest
+ include Warden::Test::Helpers
+ include Capybara::DSL
+ include CustomerTestHelper
+ include StubRecordHelper
+
+ setup do
+ Warden.test_mode!
+ @admin = stub_record :user, :admin => true
+ @customer = stub_customer
+ @braintree_customer = @customer.braintree_customer
+ response = Braintree::Subscription.create plan_id: '5',
+ payment_method_token: @braintree_customer.credit_cards.first.token
+ @subscription = response.subscription
+ Capybara.current_driver = Capybara.javascript_driver
+ end
+
+ teardown do
+ Warden.test_reset!
+ end
+
+ test "admin can see subscription for another" do
+ login_as @admin
+ @customer.stubs(:subscriptions).returns([@subscription])
+ 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 "admin cannot add subscription for another" do
+ #end
+
+ #test "authenticated user can cancel own subscription" do
+ #end
+
+ #test "user cannot add subscription if they have active one" do
+ #end
+
+ #test "user can view own subscriptions"
+ #end
+
+ #test "admin can view another user's subscriptions" do
+ #end
+
+end