mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 22:54:47 +02:00
Change test structure to follow closer newer Rails 5 rules
* Create new class called ApplicationIntegrationTest, so we don't have to override ActionDispatch::IntegrationTest * Move UI tests to inherit from ApplicationSystemTestCase * Existing REST API or EPP tests inherit from ApplicationIntegrationTest. * Move `require 'application_system_test_case'` at the end of `test_helper` I don't particularly agree with the Rails' convention of treating UI tests as system tests and API tests as integration tests, but I see no benefit in actively fighting against it.
This commit is contained in:
parent
311aa503b3
commit
526a9ccd58
41 changed files with 42 additions and 42 deletions
58
test/system/admin_area/domains/force_delete_test.rb
Normal file
58
test/system/admin_area/domains/force_delete_test.rb
Normal file
|
@ -0,0 +1,58 @@
|
|||
require 'test_helper'
|
||||
|
||||
class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
||||
include ActionMailer::TestHelper
|
||||
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
@domain = domains(:shop)
|
||||
ActionMailer::Base.deliveries.clear
|
||||
end
|
||||
|
||||
def test_schedules_domain_force_delete
|
||||
refute @domain.force_delete_scheduled?
|
||||
|
||||
visit edit_admin_domain_url(@domain)
|
||||
click_link_or_button 'Force delete domain'
|
||||
@domain.reload
|
||||
|
||||
assert @domain.force_delete_scheduled?
|
||||
assert_current_path edit_admin_domain_path(@domain)
|
||||
assert_text 'Force delete procedure has been scheduled'
|
||||
end
|
||||
|
||||
def test_notifies_registrar
|
||||
assert_difference '@domain.registrar.messages.size' do
|
||||
visit edit_admin_domain_url(@domain)
|
||||
click_link_or_button 'Force delete domain'
|
||||
end
|
||||
end
|
||||
|
||||
def test_notifies_registrant_and_admin_contacts_by_email_by_default
|
||||
assert_emails 1 do
|
||||
visit edit_admin_domain_url(@domain)
|
||||
click_link_or_button 'Force delete domain'
|
||||
end
|
||||
end
|
||||
|
||||
def test_allows_to_skip_notifying_registrant_and_admin_contacts_by_email
|
||||
assert_no_emails do
|
||||
visit edit_admin_domain_url(@domain)
|
||||
uncheck 'notify_by_email'
|
||||
click_link_or_button 'Force delete domain'
|
||||
end
|
||||
end
|
||||
|
||||
def test_cancels_scheduled_domain_force_delete
|
||||
@domain.update_attribute(:statuses, [DomainStatus::FORCE_DELETE])
|
||||
assert @domain.force_delete_scheduled?
|
||||
|
||||
visit edit_admin_domain_url(@domain)
|
||||
click_link_or_button 'Cancel force delete'
|
||||
@domain.reload
|
||||
|
||||
refute @domain.force_delete_scheduled?
|
||||
assert_current_path edit_admin_domain_path(@domain)
|
||||
assert_text 'Force delete procedure has been cancelled'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue