diff --git a/app/controllers/admin/contacts_controller.rb b/app/controllers/admin/contacts_controller.rb index 793fa1209..e008a05ae 100644 --- a/app/controllers/admin/contacts_controller.rb +++ b/app/controllers/admin/contacts_controller.rb @@ -14,7 +14,7 @@ module Admin end contacts = Contact.includes(:registrar).joins(:registrar) - .select('contacts.*, registrars.name') + .select('contacts.*, registrars.name as registrars_name') contacts = contacts.filter_by_states(params[:statuses_contains].join(',')) if params[:statuses_contains] contacts = filter_by_flags(contacts) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7bf5cd110..80c16a5a4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -51,7 +51,7 @@ module ApplicationHelper return model.creator if model.creator.is_a? String # can be api user or some other user - link_to(model.creator, ['admin', model.creator]) + link_to(model.creator, [:admin, model.creator]) end def updator_link(model) diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb new file mode 100644 index 000000000..3edd614b4 --- /dev/null +++ b/test/helpers/application_helper_test.rb @@ -0,0 +1,14 @@ +require 'test_helper' + +class ApplicationHelperTest < ActionView::TestCase + def test_creator_link + model = contacts(:william) + assert_nothing_raised do + ApplicationController.helpers.creator_link(model) + end + + assert_nothing_raised do + ApplicationController.helpers.updator_link(model) + end + end +end diff --git a/test/system/admin_area/contacts_test.rb b/test/system/admin_area/contacts_test.rb index 92b0a064b..ea37c7bc4 100644 --- a/test/system/admin_area/contacts_test.rb +++ b/test/system/admin_area/contacts_test.rb @@ -25,10 +25,16 @@ class AdminContactsTest < ApplicationSystemTestCase assert_text('william-001') assert_text('william-002') assert_text('acme-ltd-001') + assert_text(@contact.name) + assert_text(@contact.code.to_s) + assert_text(@contact.email) + assert_text(@contact.registrar.name) end def test_display_details - visit admin_contact_path(@contact) + assert_nothing_raised do + visit admin_contact_path(@contact) + end assert_text('Street Main Street City New York Postcode 12345 ' \ 'State New York State Country United States of America')