mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 16:02:03 +02:00
* 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.
30 lines
781 B
Ruby
30 lines
781 B
Ruby
require 'test_helper'
|
|
|
|
class AdminAreaDeleteRegistrarTest < ApplicationSystemTestCase
|
|
setup do
|
|
sign_in users(:admin)
|
|
end
|
|
|
|
def test_can_be_deleted_when_not_in_use
|
|
visit admin_registrar_url(registrars(:not_in_use))
|
|
|
|
assert_difference 'Registrar.count', -1 do
|
|
click_link_or_button 'Delete'
|
|
end
|
|
|
|
assert_current_path admin_registrars_path
|
|
assert_text 'Registrar has been successfully deleted'
|
|
end
|
|
|
|
def test_cannot_be_deleted_when_in_use
|
|
registrar = registrars(:bestnames)
|
|
visit admin_registrar_url(registrar)
|
|
|
|
assert_no_difference 'Registrar.count' do
|
|
click_link_or_button 'Delete'
|
|
end
|
|
|
|
assert_current_path admin_registrar_path(registrar)
|
|
assert_text 'Cannot delete record because dependent domains exist'
|
|
end
|
|
end
|