From fe4e059a848d751a425f1e614e8b76ad1186d604 Mon Sep 17 00:00:00 2001 From: Carol Nichols Date: Sat, 31 Mar 2012 22:00:16 -0400 Subject: [PATCH] There's lots of stuff called url; I think link is a bit more descriptive for this method --- app/decorators/author_decorator.rb | 2 +- app/views/users/show.haml | 2 +- test/decorators/author_decorator_test.rb | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/decorators/author_decorator.rb b/app/decorators/author_decorator.rb index 229b9373..952827f1 100644 --- a/app/decorators/author_decorator.rb +++ b/app/decorators/author_decorator.rb @@ -1,7 +1,7 @@ class AuthorDecorator < ApplicationDecorator decorates :author - def website_url + def website_link url = if model.website[0,7] == "http://" or model.website[0,8] == "https://" model.website else diff --git a/app/views/users/show.haml b/app/views/users/show.haml index 1d776a74..3b2cb0cd 100644 --- a/app/views/users/show.haml +++ b/app/views/users/show.haml @@ -32,7 +32,7 @@ .info - unless @author.website.blank? .website - = @author.website_url + = @author.website_link %p.note= @author.bio diff --git a/test/decorators/author_decorator_test.rb b/test/decorators/author_decorator_test.rb index b3d7e133..b3ff401f 100644 --- a/test/decorators/author_decorator_test.rb +++ b/test/decorators/author_decorator_test.rb @@ -3,18 +3,18 @@ describe AuthorDecorator do include TestHelper - describe '#website_url' do + describe '#website_link' do before do @author = AuthorDecorator.decorate(Fabricate(:author)) end it 'returns link to authors website' do - assert_match 'http://example.com', @author.website_url + assert_match 'http://example.com', @author.website_link end it 'returns link to authors website when website is without http prefix' do @author.website = 'test.com' - assert_match 'http://test.com', @author.website_url + assert_match 'http://test.com', @author.website_link end end end