diff options
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/public_body/show.rhtml_spec.rb | 15 | ||||
-rw-r--r-- | spec/views/request/_after_actions.rhtml_spec.rb | 27 | ||||
-rw-r--r-- | spec/views/request/list.rhtml_spec.rb | 6 |
3 files changed, 11 insertions, 37 deletions
diff --git a/spec/views/public_body/show.rhtml_spec.rb b/spec/views/public_body/show.rhtml_spec.rb index 7793b9b38..cd81888eb 100644 --- a/spec/views/public_body/show.rhtml_spec.rb +++ b/spec/views/public_body/show.rhtml_spec.rb @@ -1,7 +1,6 @@ require File.dirname(__FILE__) + '/../../spec_helper' describe "when viewing a body" do - before do @pb = mock_model(PublicBody, :name => 'Test Quango', @@ -28,6 +27,8 @@ describe "when viewing a body" do assigns[:xapian_requests] = @xap assigns[:page] = 1 assigns[:per_page] = 10 + # work round a bug in ActionController::TestRequest; allows request.query_string to work in the template + request.env["REQUEST_URI"] = "" end it "should be successful" do @@ -47,11 +48,11 @@ describe "when viewing a body" do it "should tell total number of requests" do render "public_body/show" - response.should include_text("4 Freedom of Information requests made") + response.should include_text("4 Freedom of Information requests") end it "should cope with no results" do - @xap.stub!(:results).and_return([]) + @pb.stub!(:info_requests).and_return([]) render "public_body/show" response.should have_tag("p", /Nobody has made any Freedom of Information requests/m) end @@ -67,10 +68,10 @@ describe "when viewing a body" do @pb.stub!(:get_tag_values).and_return(['98765', '12345']) render "public_body/show" - response.should have_tag("div#request_sidebar") do + response.should have_tag("div#header_right") do with_tag("a[href*=?]", /charity-commission.gov.uk.*RegisteredCharityNumber=98765$/) end - response.should have_tag("div#request_sidebar") do + response.should have_tag("div#header_right") do with_tag("a[href*=?]", /charity-commission.gov.uk.*RegisteredCharityNumber=12345$/) end end @@ -80,7 +81,7 @@ describe "when viewing a body" do @pb.stub!(:get_tag_values).and_return(['SC1234']) render "public_body/show" - response.should have_tag("div#request_sidebar") do + response.should have_tag("div#header_right") do with_tag("a[href*=?]", /www.oscr.org.uk.*id=SC1234$/) end end @@ -88,7 +89,7 @@ describe "when viewing a body" do 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 + response.should have_tag("div#header_right") do without_tag("a[href*=?]", /charity-commission.gov.uk/) end end diff --git a/spec/views/request/_after_actions.rhtml_spec.rb b/spec/views/request/_after_actions.rhtml_spec.rb index a92ef2dda..c73f35d33 100644 --- a/spec/views/request/_after_actions.rhtml_spec.rb +++ b/spec/views/request/_after_actions.rhtml_spec.rb @@ -79,30 +79,5 @@ describe 'when displaying actions that can be taken with regard to a request' do it 'should display a link for the request owner to request a review' do expect_owner_link('Request an internal review') end - - describe 'when there is no last response' do - - before do - assigns[:last_response] = nil - end - - it 'should display a link for the request owner to send a follow up' do - expect_owner_link('Send follow up to test public body') - end - - end - - describe 'when there is a last response' do - before do - assigns[:last_response] = mock_model(IncomingMessage, - :valid_to_reply_to? => false) - end - - it 'should display a link for the request owner to reply to the last response' do - expect_owner_link('Reply to test public body') - end - - end - -end
\ No newline at end of file +end diff --git a/spec/views/request/list.rhtml_spec.rb b/spec/views/request/list.rhtml_spec.rb index 578bd5cc8..60a28eec5 100644 --- a/spec/views/request/list.rhtml_spec.rb +++ b/spec/views/request/list.rhtml_spec.rb @@ -5,7 +5,8 @@ describe "when listing recent requests" do before do assigns[:page] = 1 assigns[:per_page] = 10 - + # work round a bug in ActionController::TestRequest; allows request.query_string to work in the template + request.env["REQUEST_URI"] = "" # we're not testing the interlock plugin's cache template.stub!(:view_cache).and_yield end @@ -32,9 +33,7 @@ describe "when listing recent requests" do it "should be successful" do assigns[:list_results] = [ make_mock_event, make_mock_event ] assigns[:matches_estimated] = 2 - render "request/list" - response.should have_tag("div.request_listing") response.should_not have_tag("p", /No requests of this sort yet/m) end @@ -42,7 +41,6 @@ describe "when listing recent requests" do it "should cope with no results" do assigns[:list_results] = [ ] assigns[:matches_estimated] = 0 - render "request/list" response.should have_tag("p", /No requests of this sort yet/m) response.should_not have_tag("div.request_listing") |