diff options
-rw-r--r-- | app/views/body/show.rhtml | 3 | ||||
-rw-r--r-- | spec/views/body_view_spec.rb | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/app/views/body/show.rhtml b/app/views/body/show.rhtml index be5fef30c..82e304478 100644 --- a/app/views/body/show.rhtml +++ b/app/views/body/show.rhtml @@ -10,6 +10,9 @@ <% if !@public_body.publication_scheme.empty? %> <%= 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/CharityWithPartB.aspx?RegisteredCharityNumber=' + @public_body.charity_number %><br> + <% end %> <%= link_to "View FOI email address", view_public_body_email_url(@public_body.url_name) %> </div> diff --git a/spec/views/body_view_spec.rb b/spec/views/body_view_spec.rb index 644d14250..8f8ec156c 100644 --- a/spec/views/body_view_spec.rb +++ b/spec/views/body_view_spec.rb @@ -8,6 +8,7 @@ describe "when viewing a body" do :short_name => 'tq', :url_name => 'testquango', :notes => '', + :charity_number => '', :type_of_authority => 'A public body', :eir_only? => nil, :info_requests => [1, 2, 3, 4], # out of sync with Xapian @@ -59,6 +60,22 @@ describe "when viewing a body" do response.should have_tag("p", /The search index is currently offline/m) end + it "should link to Charity Commission site if we have a number" do + @pb.stub!(:charity_number).and_return('98765') + render "body/show" + response.should have_tag("div#request_sidebar") do + with_tag("a[href*=?]", /charity-commission.gov.uk.*RegisteredCharityNumber=98765$/) + end + end + + it "should not link to Charity Commission site if we don't have number" do + render "body/show" + response.should_not have_tag("div#request_sidebar") do + with_tag("a[href*=?]", /charity-commission.gov.uk/) + end + end + + end def mock_event |