diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index e3b882fe7..32e4b3de6 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -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 @@ -16,4 +16,4 @@ module TagsHelper tag = normalized_tag_name link_to("##{tag}", tag_path(:name => tag)) end -end \ No newline at end of file +end diff --git a/spec/helpers/tags_helper_spec.rb b/spec/helpers/tags_helper_spec.rb new file mode 100644 index 000000000..b8f3f1b15 --- /dev/null +++ b/spec/helpers/tags_helper_spec.rb @@ -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