aboutsummaryrefslogtreecommitdiffstats
path: root/spec/views
diff options
context:
space:
mode:
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/public_body/show.rhtml_spec.rb11
-rw-r--r--spec/views/request/show.rhtml_spec.rb25
2 files changed, 23 insertions, 13 deletions
diff --git a/spec/views/public_body/show.rhtml_spec.rb b/spec/views/public_body/show.rhtml_spec.rb
index fbd05b9d1..5fec84af4 100644
--- a/spec/views/public_body/show.rhtml_spec.rb
+++ b/spec/views/public_body/show.rhtml_spec.rb
@@ -47,7 +47,7 @@ describe "when viewing a body" do
it "should tell total number of requests" do
render "public_body/show"
- response.should have_tag("h2", "4 Freedom of Information requests made")
+ response.should include_text("4 Freedom of Information requests made")
end
it "should cope with no results" do
@@ -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
diff --git a/spec/views/request/show.rhtml_spec.rb b/spec/views/request/show.rhtml_spec.rb
index b17521a4b..22860f0c5 100644
--- a/spec/views/request/show.rhtml_spec.rb
+++ b/spec/views/request/show.rhtml_spec.rb
@@ -4,7 +4,8 @@ describe 'when viewing an information request' do
before do
@mock_body = mock_model(PublicBody, :name => 'test body',
- :url_name => 'test_body')
+ :url_name => 'test_body',
+ :is_school? => false)
@mock_user = mock_model(User, :name => 'test user',
:url_name => 'test_user')
@mock_request = mock_model(InfoRequest, :title => 'test request',
@@ -17,22 +18,22 @@ describe 'when viewing an information request' do
:prominence => 'normal')
end
- def do_render
+ def request_page
assigns[:info_request] = @mock_request
assigns[:info_request_events] = []
assigns[:status] = @mock_request.calculate_status
- template.stub!(:render)
+ template.stub!(:render_partial)
render 'request/show'
end
it 'should show the sidebar' do
- template.should_receive(:render).with(:partial => 'sidebar')
- do_render
+ template.should_receive(:render_partial).with(:partial => 'sidebar', :locals => {})
+ request_page
end
it 'should show the actions people can take' do
- template.should_receive(:render).with(:partial => 'after_actions')
- do_render
+ template.should_receive(:render_partial).with(:partial => 'after_actions', :locals => {})
+ request_page
end
describe 'when a status update has been requested' do
@@ -42,7 +43,7 @@ describe 'when viewing an information request' do
end
it 'should show the first form for describing the state of the request' do
- do_render
+ request_page
response.should have_tag("div.describe_state_form#describe_state_form_1")
end
@@ -55,12 +56,12 @@ describe 'when viewing an information request' do
end
it 'should show the first form for describing the state of the request' do
- do_render
+ request_page
response.should have_tag("div.describe_state_form#describe_state_form_1")
end
it 'should show the second form for describing the state of the request' do
- do_render
+ request_page
response.should have_tag("div.describe_state_form#describe_state_form_2")
end
@@ -86,7 +87,7 @@ describe 'when viewing an information request' do
end
it 'should show a link to follow up the last response with clarification' do
- do_render
+ request_page
expected_url = "http://test.host/request/#{@mock_request.id}/response/#{@mock_response.id}#followup"
response.should have_tag("a[href=#{expected_url}]", :text => 'send a follow up message')
end
@@ -100,7 +101,7 @@ describe 'when viewing an information request' do
end
it 'should show a link to follow up the request without reference to a specific response' do
- do_render
+ request_page
expected_url = "http://test.host/request/#{@mock_request.id}/response#followup"
response.should have_tag("a[href=#{expected_url}]", :text => 'send a follow up message')
end