diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 21dc56d..5612969 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -40,13 +40,10 @@ module SearchHelper end def display_profile_info(profile) - profile_info = '' - profile_info << content_tag('strong', profile.name) + '
' - profile_info << link_to(url_for(profile.url), profile.url) + '
' - content_tag( 'table', - content_tag( 'tr', + content_tag('table', + content_tag('tr', content_tag('td', content_tag('div', profile_image(profile, :thumb), :class => 'profile-info-picture')) + - content_tag('td', profile_info) + content_tag('td', content_tag('strong', profile.name) + '
' + link_to(url_for(profile.url), profile.url) + '
') ), :class => 'profile-info' ) diff --git a/test/unit/search_helper.rb b/test/unit/search_helper.rb index 3d6a04a..0dfeabd 100644 --- a/test/unit/search_helper.rb +++ b/test/unit/search_helper.rb @@ -2,13 +2,28 @@ require File.dirname(__FILE__) + '/../test_helper' class SearchHelperTest < Test::Unit::TestCase + include SearchHelper + def setup @profile = mock - @helper = mock - helper.extend(SearchHelper) end - attr_reader :profile, :helper + attr_reader :profile + + include ActionView::Helpers::FormOptionsHelper + include ActionView::Helpers::FormTagHelper + include ActionView::Helpers::TagHelper + should 'display profile info' do + profile.expects(:name).returns('Name of Profile') + profile.stubs(:url).returns('') - should 'display profile info' + self.expects(:profile_image).returns('profileimage.png') + self.expects(:url_for).returns('merda') + self.expects(:link_to).returns('link to profile') + + result = self.display_profile_info(profile) + assert_match /profileimage.png/, result + assert_match /link to profile/, result + assert_match /Name of Profile<\/strong>/, result + end end -- libgit2 0.21.2