From 02aad0d7813e43bcc5e56278acf37811cbca728f Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Sun, 15 Jul 2018 19:01:43 +0300 Subject: [PATCH] Add tests --- test/integration/admin/api_user/new_test.rb | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/integration/admin/api_user/new_test.rb diff --git a/test/integration/admin/api_user/new_test.rb b/test/integration/admin/api_user/new_test.rb new file mode 100644 index 000000000..32b2e1188 --- /dev/null +++ b/test/integration/admin/api_user/new_test.rb @@ -0,0 +1,25 @@ +require 'test_helper' + +class AdminAreaNewApiUserTest < ActionDispatch::IntegrationTest + 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 \ No newline at end of file