mirror of
https://github.com/neocities/neocities.git
synced 2025-08-05 01:01:30 +02:00
further cleanups to filtering code
This commit is contained in:
parent
a7ee94b0c7
commit
aa56561dff
6 changed files with 52 additions and 16 deletions
|
@ -35,12 +35,14 @@ describe 'signup' do
|
|||
|
||||
after do
|
||||
Capybara.default_driver = :rack_test
|
||||
BlockedIp.where(ip: '127.0.0.1').delete
|
||||
DB[:sites].where(is_banned: true).delete
|
||||
end
|
||||
|
||||
it 'succeeds with valid data' do
|
||||
fill_in_valid
|
||||
click_signup_button
|
||||
site_created?.must_equal true
|
||||
site_created?
|
||||
|
||||
index_file_path = File.join Site::SITE_FILES_ROOT, @site[:username], 'index.html'
|
||||
File.exist?(index_file_path).must_equal true
|
||||
|
@ -54,6 +56,27 @@ describe 'signup' do
|
|||
site.ip.must_equal Site.hash_ip('127.0.0.1')
|
||||
end
|
||||
|
||||
it 'fails if site with same ip has been banned' do
|
||||
@banned_site = Fabricate :site
|
||||
@banned_site.is_banned = true
|
||||
@banned_site.save_changes
|
||||
|
||||
fill_in_valid
|
||||
click_signup_button
|
||||
Site[username: @site[:username]].must_be_nil
|
||||
current_path.must_equal '/'
|
||||
page.wont_have_content 'Welcome to Neocities'
|
||||
end
|
||||
|
||||
it 'fails if IP is banned from blocked ips list' do
|
||||
DB[:blocked_ips].insert(ip: '127.0.0.1', created_at: Time.now)
|
||||
fill_in_valid
|
||||
click_signup_button
|
||||
Site[username: @site[:username]].must_be_nil
|
||||
current_path.must_equal '/'
|
||||
page.wont_have_content 'Welcome to Neocities'
|
||||
end
|
||||
|
||||
it 'fails to create for existing site' do
|
||||
@existing_site = Fabricate :site
|
||||
fill_in_valid
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue