mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
Merge pull request #1989 from internetee/fix-creator-link
Fix contact creator link
This commit is contained in:
commit
760076706e
4 changed files with 23 additions and 3 deletions
|
@ -14,7 +14,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
contacts = Contact.includes(:registrar).joins(:registrar)
|
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 = contacts.filter_by_states(params[:statuses_contains].join(',')) if params[:statuses_contains]
|
||||||
contacts = filter_by_flags(contacts)
|
contacts = filter_by_flags(contacts)
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ module ApplicationHelper
|
||||||
return model.creator if model.creator.is_a? String
|
return model.creator if model.creator.is_a? String
|
||||||
|
|
||||||
# can be api user or some other user
|
# can be api user or some other user
|
||||||
link_to(model.creator, ['admin', model.creator])
|
link_to(model.creator, [:admin, model.creator])
|
||||||
end
|
end
|
||||||
|
|
||||||
def updator_link(model)
|
def updator_link(model)
|
||||||
|
|
14
test/helpers/application_helper_test.rb
Normal file
14
test/helpers/application_helper_test.rb
Normal file
|
@ -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
|
|
@ -25,10 +25,16 @@ class AdminContactsTest < ApplicationSystemTestCase
|
||||||
assert_text('william-001')
|
assert_text('william-001')
|
||||||
assert_text('william-002')
|
assert_text('william-002')
|
||||||
assert_text('acme-ltd-001')
|
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
|
end
|
||||||
|
|
||||||
def test_display_details
|
def test_display_details
|
||||||
|
assert_nothing_raised do
|
||||||
visit admin_contact_path(@contact)
|
visit admin_contact_path(@contact)
|
||||||
|
end
|
||||||
|
|
||||||
assert_text('Street Main Street City New York Postcode 12345 ' \
|
assert_text('Street Main Street City New York Postcode 12345 ' \
|
||||||
'State New York State Country United States of America')
|
'State New York State Country United States of America')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue