diff options
-rw-r--r-- | app/views/public_body/show.rhtml | 6 | ||||
-rw-r--r-- | spec/views/public_body/show.rhtml_spec.rb | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index 788d83912..81049fa7a 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -11,7 +11,11 @@ <%= link_to "Publication scheme", @public_body.publication_scheme %><br> <% end %> <% if !@public_body.charity_number.empty? %> - <%= link_to "Charity overview", 'http://www.charity-commission.gov.uk/SHOWCHARITY/RegisterOfCharities/CharityFramework.aspx?RegisteredCharityNumber=' + @public_body.charity_number %><br> + <% if @public_body.charity_number.match(/^SC/) %> + <%= link_to "Charity overview", "http://www.oscr.org.uk/CharityIndexDetails.aspx?id=" + @public_body.charity_number %> + <% else %> + <%= link_to "Charity overview", "http://www.charity-commission.gov.uk/SHOWCHARITY/RegisterOfCharities/CharityFramework.aspx?RegisteredCharityNumber=" + @public_body.charity_number %> + <% end %> <% end %> <%= link_to "View FOI email address", view_public_body_email_url(@public_body.url_name) %> </div> diff --git a/spec/views/public_body/show.rhtml_spec.rb b/spec/views/public_body/show.rhtml_spec.rb index fbd05b9d1..7464320ed 100644 --- a/spec/views/public_body/show.rhtml_spec.rb +++ b/spec/views/public_body/show.rhtml_spec.rb @@ -70,6 +70,15 @@ describe "when viewing a body" do end end + it "should link to Scottish Charity Regulator site if we have an SC number" do + @pb.stub!(:charity_number).and_return('SC1234') + render "public_body/show" + response.should have_tag("div#request_sidebar") do + with_tag("a[href*=?]", /www.oscr.org.uk.*id=SC1234$/) + end + end + + it "should not link to Charity Commission site if we don't have number" do render "public_body/show" response.should have_tag("div#request_sidebar") do |