-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Artur Beljajev
committed
Oct 27, 2017
1 parent
36db859
commit 579da84
Showing
6 changed files
with
82 additions
and
59 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'test_helper' | ||
|
||
class RegistrarsControllerTest < ActionDispatch::IntegrationTest | ||
def setup | ||
login_as create(:admin_user) | ||
end | ||
|
||
def test_creates_new_registrar | ||
assert_difference -> { Registrar.count } do | ||
post admin_registrars_path, registrar: attributes_for(:registrar) | ||
end | ||
end | ||
|
||
def test_redirects_to_newly_created_registrar | ||
post admin_registrars_path, registrar: attributes_for(:registrar) | ||
assert_redirected_to admin_registrar_path(Registrar.first) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require 'test_helper' | ||
|
||
class RegistrarsControllerTest < ActionDispatch::IntegrationTest | ||
def setup | ||
login_as create(:admin_user) | ||
end | ||
|
||
def test_updates_website | ||
registrar = create(:registrar, website: 'test') | ||
|
||
patch admin_registrar_path(registrar), registrar: attributes_for(:registrar, website: 'new-website') | ||
registrar.reload | ||
|
||
assert_equal 'new-website', registrar.website | ||
end | ||
|
||
def test_updates_email | ||
registrar = create(:registrar, email: 'test@test.com') | ||
|
||
patch admin_registrar_path(registrar), registrar: attributes_for(:registrar, email: 'new-test@test.com') | ||
registrar.reload | ||
|
||
assert_equal 'new-test@test.com', registrar.email | ||
end | ||
|
||
def test_updates_billing_email | ||
registrar = create(:registrar, billing_email: 'test@test.com') | ||
|
||
patch admin_registrar_path(registrar), registrar: attributes_for(:registrar, billing_email: 'new-test@test.com') | ||
registrar.reload | ||
|
||
assert_equal 'new-test@test.com', registrar.billing_email | ||
end | ||
|
||
def test_redirects_to_registrar | ||
registrar = create(:registrar) | ||
patch admin_registrar_path(registrar), registrar: attributes_for(:registrar) | ||
assert_redirected_to admin_registrar_path(registrar) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'test_helper' | ||
|
||
class EditRegistrarTest < ActionDispatch::IntegrationTest | ||
def setup | ||
login_as create(:admin_user) | ||
end | ||
|
||
def test_updates_registrar | ||
registrar = create(:registrar) | ||
|
||
visit admin_registrar_path(registrar) | ||
click_link_or_button 'Edit' | ||
click_link_or_button 'Update registrar' | ||
|
||
assert_text 'Registrar has been successfully updated' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters