Simplify test

This commit is contained in:
Artur Beljajev 2019-12-09 20:03:27 +02:00
parent b4be9e7f00
commit 19e45f0a70
2 changed files with 28 additions and 25 deletions

View file

@ -1,25 +0,0 @@
require 'application_system_test_case'
class AdminAreaNewApiUserTest < ApplicationSystemTestCase
setup do
sign_in users(:admin)
end
def test_new_api_user_creation_with_required_params
visit admin_api_users_url
click_link_or_button 'New API user'
fill_in 'Username', with: 'newtest'
fill_in 'Password', with: 'testtest'
find('#api_user_registrar_id', visible: false).set(registrars(:bestnames).id)
assert_difference 'ApiUser.count' do
click_link_or_button 'Save'
end
assert_current_path admin_api_user_path(ApiUser.last)
assert_text 'Record created'
assert_text 'Username newtest'
assert_text 'Password testtest'
end
end

View file

@ -0,0 +1,28 @@
require 'application_system_test_case'
class AdminRegistrarsApiUsersSystemTest < ApplicationSystemTestCase
setup do
sign_in users(:admin)
end
def test_creates_new_api_user_with_required_attributes
username = 'john'
registrar = registrars(:bestnames)
visit admin_registrar_path(registrar)
click_on 'New API user'
fill_in 'Username', with: username
fill_in 'Password', with: valid_password
click_on 'Save'
assert_text 'Record created'
assert_text "Username #{username}"
end
private
def valid_password
'testtest'
end
end