Fix tags_helper, add specs
This commit is contained in:
parent
782885c58d
commit
e4fa8d8466
2 changed files with 21 additions and 3 deletions
|
|
@ -1,9 +1,9 @@
|
|||
module TagsHelper
|
||||
def looking_for_tag_link
|
||||
return if @search_query.include?('@') || normalized_tag_name.blank?
|
||||
return if search_query.include?('@') || normalized_tag_name.blank?
|
||||
content_tag('h4') do
|
||||
content_tag('small') do
|
||||
t('.looking_for', :tag_link => tag_link).html_safe
|
||||
t('people.index.looking_for', :tag_link => tag_link).html_safe
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
18
spec/helpers/tags_helper_spec.rb
Normal file
18
spec/helpers/tags_helper_spec.rb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe TagsHelper do
|
||||
describe '#looking_for_tag_link' do
|
||||
it 'returns nil if there is a @ in the query' do
|
||||
helper.stub(:search_query).and_return('foo@bar.com')
|
||||
helper.looking_for_tag_link.should be_nil
|
||||
end
|
||||
it 'returns nil if it normalizes to blank' do
|
||||
helper.stub(:search_query).and_return('++')
|
||||
helper.looking_for_tag_link.should be_nil
|
||||
end
|
||||
it 'returns a link to the tag otherwise' do
|
||||
helper.stub(:search_query).and_return('foo')
|
||||
helper.looking_for_tag_link.should include(helper.tag_link)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue