mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
more fixes for tests
This commit is contained in:
parent
8052844640
commit
9c6ed2d7c5
6 changed files with 17 additions and 34 deletions
|
@ -28,17 +28,6 @@ describe '/admin' do
|
|||
describe 'supporter upgrade' do
|
||||
include Capybara::DSL
|
||||
|
||||
before do
|
||||
stripe_helper = StripeMock.create_test_helper
|
||||
StripeMock.start
|
||||
stripe_helper.create_product(id: 'supporter', name: 'Supporter Plan')
|
||||
@plan = stripe_helper.create_plan(product: 'supporter', amount: 0)
|
||||
end
|
||||
|
||||
after do
|
||||
StripeMock.stop
|
||||
end
|
||||
|
||||
it 'works for valid site' do
|
||||
within(:css, '#upgradeToSupporter') do
|
||||
fill_in 'username', with: @site.username
|
||||
|
|
|
@ -155,10 +155,6 @@ describe 'delete' do
|
|||
visit "/settings/#{@site[:username]}#delete"
|
||||
end
|
||||
|
||||
after do
|
||||
StripeMock.stop
|
||||
end
|
||||
|
||||
it 'fails for incorrect entered username' do
|
||||
fill_in 'username', with: 'NOPE'
|
||||
click_button 'Delete Site'
|
||||
|
@ -191,13 +187,8 @@ describe 'delete' do
|
|||
end
|
||||
|
||||
it 'stops charging for supporter account' do
|
||||
@stripe_helper = StripeMock.create_test_helper
|
||||
StripeMock.start
|
||||
@stripe_helper.create_plan id: 'supporter', amount: 500
|
||||
@stripe_helper.create_plan id: 'free', amount: 0
|
||||
|
||||
customer = Stripe::Customer.create(
|
||||
source: @stripe_helper.generate_card_token
|
||||
source: $stripe_helper.generate_card_token
|
||||
)
|
||||
|
||||
subscription = customer.subscriptions.create plan: 'supporter'
|
||||
|
|
|
@ -8,23 +8,17 @@ describe '/supporter' do
|
|||
Capybara.reset_sessions!
|
||||
|
||||
@site = Fabricate :site
|
||||
@stripe_helper = StripeMock.create_test_helper
|
||||
StripeMock.start
|
||||
@stripe_helper.create_product(id: 'supporter', name: 'Supporter')
|
||||
@stripe_helper.create_plan product: 'supporter', amount: 500
|
||||
page.set_rack_session id: @site.id
|
||||
EmailWorker.jobs.clear
|
||||
Mail::TestMailer.deliveries.clear
|
||||
end
|
||||
|
||||
after do
|
||||
StripeMock.stop
|
||||
Capybara.default_driver = :rack_test
|
||||
end
|
||||
|
||||
it 'should work for paypal' do
|
||||
|
||||
end
|
||||
#it 'should work for paypal' do
|
||||
#end
|
||||
|
||||
it 'should work for fresh signup' do
|
||||
visit '/supporter'
|
||||
|
@ -34,7 +28,7 @@ describe '/supporter' do
|
|||
find('.cc-name').set 'Penelope'
|
||||
all('.flip-tab').first.click
|
||||
find('.cc-cvc').set '123'
|
||||
page.evaluate_script("document.getElementById('stripe_token').value = '#{@stripe_helper.generate_card_token}'")
|
||||
page.evaluate_script("document.getElementById('stripe_token').value = '#{$stripe_helper.generate_card_token}'")
|
||||
click_link 'Upgrade for $5/mo'
|
||||
_(page.current_path).must_equal '/supporter/thanks'
|
||||
all('.txt-Center')
|
||||
|
|
|
@ -73,3 +73,11 @@ end
|
|||
FileUtils.mkdir_p p
|
||||
File.write File.join(p, '.gitignore'), '*'
|
||||
end
|
||||
|
||||
$stripe_helper = StripeMock.create_test_helper
|
||||
StripeMock.start
|
||||
|
||||
product = $stripe_helper.create_product name: 'supporter'
|
||||
$stripe_helper.create_plan id: 'supporter', amount: 500, product: product.id
|
||||
$stripe_helper.create_plan id: 'free', amount: 0, product: product.id
|
||||
$stripe_helper.create_plan id: 'special', amount: 0, product: product.id
|
|
@ -83,13 +83,13 @@ describe 'site_files' do
|
|||
|
||||
it 'wont set an empty directory' do
|
||||
@site.create_directory 'dirone'
|
||||
@site.site_files.select {|sf| sf.path == 'dirone'}.length.must_equal 1
|
||||
_(@site.site_files.select {|sf| sf.path == 'dirone'}.length).must_equal 1
|
||||
|
||||
dirone = @site.site_files_dataset.where(path: 'dirone').first
|
||||
res = dirone.rename('')
|
||||
@site.site_files_dataset.where(path: '').count.must_equal 0
|
||||
res.must_equal [false, 'cannot rename to empty path']
|
||||
@site.site_files_dataset.where(path: '').count.wont_equal 1
|
||||
_(@site.site_files_dataset.where(path: '').count).must_equal 0
|
||||
_(res).must_equal [false, 'cannot rename to empty path']
|
||||
_(@site.site_files_dataset.where(path: '').count).wont_equal 1
|
||||
end
|
||||
|
||||
it 'changes path of files and dirs within directory when changed' do
|
||||
|
|
|
@ -8,6 +8,7 @@ describe ArchiveWorker do
|
|||
ArchiveWorker.new.perform site.id
|
||||
_(site.archives.length).must_equal 1
|
||||
archive_one = site.archives.first
|
||||
_(archive_one.ipfs_hash).wont_be_nil
|
||||
_(archive_one.ipfs_hash).must_equal ipfs_hash
|
||||
_(archive_one.updated_at).wont_be_nil
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue