mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Added admin contacts feature spec and fixed helpers
This commit is contained in:
parent
b2ec23edc9
commit
e63a59c263
2 changed files with 28 additions and 3 deletions
|
@ -20,7 +20,7 @@ module ApplicationHelper
|
|||
|
||||
def creator_link(model)
|
||||
return 'not present' if model.blank?
|
||||
return model if model.is_a? String
|
||||
return model.creator if model.creator.is_a? String
|
||||
|
||||
# can be api user or some other user
|
||||
link_to(model.creator, ['admin', model.creator])
|
||||
|
@ -28,9 +28,9 @@ module ApplicationHelper
|
|||
|
||||
def updator_link(model)
|
||||
return 'not present' if model.blank?
|
||||
return model if model.is_a? String
|
||||
return model.updator if model.updator.is_a? String
|
||||
|
||||
# can be api user or some other user
|
||||
link_to(model.creator, ['admin', model.updator])
|
||||
link_to(model.updator, ['admin', model.updator])
|
||||
end
|
||||
end
|
||||
|
|
25
spec/features/admin/contact_spec.rb
Normal file
25
spec/features/admin/contact_spec.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Admin contact', type: :feature do
|
||||
background { create_settings }
|
||||
|
||||
before :all do
|
||||
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
|
||||
@contact = Fabricate(:contact, name: 'Mr John')
|
||||
end
|
||||
|
||||
it 'should show index of contacts' do
|
||||
sign_in @user
|
||||
visit admin_contacts_url
|
||||
|
||||
page.should have_content('Mr John')
|
||||
end
|
||||
|
||||
it 'should show correct contact creator' do
|
||||
sign_in @user
|
||||
visit admin_contacts_url
|
||||
|
||||
click_link('Mr John')
|
||||
page.should have_content('by autotest')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue