From e674a6572edd91fef97241e0195e475ec8b5b3af Mon Sep 17 00:00:00 2001 From: Lucy Date: Wed, 3 Jul 2013 13:16:36 +0100 Subject: [PATCH] Added conversion links for recommended prices. The paragraphs were getting a bit verbose so we shortened the link text as well. Added an additional test to make sure the link is working here too. --- app/helpers/application_helper.rb | 2 +- app/views/shop/index.html.haml | 2 +- spec/views/shop/index_spec.rb | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fcd8e1cdc..ff8132be8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -19,7 +19,7 @@ module ApplicationHelper pid = price_in_dollars(price) currency = Growstuff::Application.config.currency link = "http://www.wolframalpha.com/input/?i=#{pid}+#{currency}" - return link_to "See exchange rates", + return link_to "(convert)", link, :target => "_blank" end diff --git a/app/views/shop/index.html.haml b/app/views/shop/index.html.haml index 802ca7fe6..d955c9579 100644 --- a/app/views/shop/index.html.haml +++ b/app/views/shop/index.html.haml @@ -55,12 +55,12 @@ Pay what you want, starting at =succeed "." do =price_with_currency(p.min_price) - =succeed "." do =forex_link(p.min_price) - if p.recommended_price Recommended price: =succeed "." do =price_with_currency(p.recommended_price) + =forex_link(p.recommended_price) %div - if can? :create, Order diff --git a/spec/views/shop/index_spec.rb b/spec/views/shop/index_spec.rb index ced2fee99..de8f011d8 100644 --- a/spec/views/shop/index_spec.rb +++ b/spec/views/shop/index_spec.rb @@ -32,6 +32,11 @@ describe 'shop/index.html.haml', :type => "view" do rendered.should contain '12.00 AUD' end + it 'should contain an exchange rate link for recommended price' do + currency = Growstuff::Application.config.currency + assert_select("a[href=http://www.wolframalpha.com/input/?i=12.00+#{currency}]") + end + it 'displays the order form' do assert_select "form", :count => 2 end