major refactor of supporter structure

This commit is contained in:
Kyle Drake 2016-10-18 12:47:58 -05:00
parent dadeb778c9
commit 2c88c62cbc
45 changed files with 440 additions and 1704 deletions

View file

@ -312,12 +312,10 @@ describe 'delete' do
fill_in 'deleted_reason', with: 'derp'
click_button 'Delete Site'
subscription = Stripe::Customer.retrieve(@site.stripe_customer_id).subscriptions.first
subscription.plan.id.must_equal 'free'
Stripe::Customer.retrieve(@site.stripe_customer_id).subscriptions.count.must_equal 0
@site.reload
@site.stripe_subscription_id.must_equal nil
@site.is_deleted.must_equal true
@site.plan_type.must_equal 'free'
end
it 'should fail unless owned by current user' do

View file

@ -1,6 +1,6 @@
require_relative './environment.rb'
describe '/plan' do
describe '/supporter' do
include Capybara::DSL
before do
@ -24,16 +24,16 @@ describe '/plan' do
end
it 'should work for fresh signup' do
visit '/plan'
visit '/supporter'
fill_in 'Card Number', with: '4242424242424242'
fill_in 'Expiration Month', with: '01'
fill_in 'Expiration Year', with: Date.today.next_year
fill_in 'Cardholder\'s Name', with: 'Penelope'
fill_in 'Card Validation Code', with: '123'
find('#stripe_token').set @stripe_helper.generate_card_token
find('#upgradePlanType').set 'supporter'
click_button 'Upgrade'
page.current_path.must_equal '/plan/thanks'
#find('#upgradePlanType').set 'supporter'
click_link 'Upgrade for'
page.current_path.must_equal '/supporter/thanks'
page.body.must_match /You now have the Supporter plan./
@site.reload
@site.stripe_customer_id.wont_be_nil

View file

@ -10,7 +10,7 @@ describe Site do
site = Fabricate :site
site.ban!
File.exist?(site.current_files_path('index.html')).must_equal true
site.current_files_path('index.html').must_equal File.join(Site::BANNED_SITES_ROOT, site.username, 'index.html')
site.current_files_path('index.html').must_equal File.join(Site::DELETED_SITES_ROOT, site.username, 'index.html')
end
end