diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-10-17 14:55:55 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-10-17 14:55:55 +0100 |
commit | e6dc0f6606b26e13cb0cd16124fdb2aad3c1b5a6 (patch) | |
tree | c376463aedff99886779eebf1da1ac5eb9da8370 /spec/views/request/_after_actions.rhtml_spec.rb | |
parent | 6f804977c8dc790777af220f821bccb8a04e1be3 (diff) |
Revert "Revert "Merge remote-tracking branch 'henare_github/patch-1'""
This reverts commit 211fe84dc40d97df8aa8724906d9170ed4f78477.
Diffstat (limited to 'spec/views/request/_after_actions.rhtml_spec.rb')
-rw-r--r-- | spec/views/request/_after_actions.rhtml_spec.rb | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/spec/views/request/_after_actions.rhtml_spec.rb b/spec/views/request/_after_actions.rhtml_spec.rb index d04db3fc2..5b4734c52 100644 --- a/spec/views/request/_after_actions.rhtml_spec.rb +++ b/spec/views/request/_after_actions.rhtml_spec.rb @@ -1,85 +1,86 @@ require File.expand_path(File.join('..', '..', '..', 'spec_helper'), __FILE__) -describe 'when displaying actions that can be taken with regard to a request' do - - before do - @mock_body = mock_model(PublicBody, :name => 'test public body', +describe 'when displaying actions that can be taken with regard to a request' do + + before do + @mock_body = mock_model(PublicBody, :name => 'test public body', :url_name => 'test_public_body') - @mock_user = mock_model(User, :name => 'test user', + @mock_user = mock_model(User, :name => 'test user', :url_name => 'test_user') - @mock_request = mock_model(InfoRequest, :title => 'test request', - :user => @mock_user, - :user_name => @mock_user.name, + @mock_request = mock_model(InfoRequest, :title => 'test request', + :user => @mock_user, + :user_name => @mock_user.name, :is_external? => false, - :public_body => @mock_body, + :public_body => @mock_body, + :comments_allowed? => true, :url_title => 'test_request') assigns[:info_request] = @mock_request end - + def do_render render :partial => 'request/after_actions' end - + def expect_owner_div do_render response.should have_tag('div#owner_actions'){ yield } end - + def expect_anyone_div do_render response.should have_tag('div#anyone_actions'){ yield } end - + def expect_owner_link(text) expect_owner_div{ with_tag('a', :text => text) } end - + def expect_no_owner_link(text) expect_owner_div{ without_tag('a', :text => text) } end - + def expect_anyone_link(text) expect_anyone_div{ with_tag('a', :text => text) } end - + def expect_no_anyone_link(text) expect_anyone_div{ without_tag('a', :text => text) } end - - describe 'if the request is old and unclassified' do - - before do + + describe 'if the request is old and unclassified' do + + before do assigns[:old_unclassified] = true end - - it 'should not display a link for the request owner to update the status of the request' do + + it 'should not display a link for the request owner to update the status of the request' do expect_no_owner_link('Update the status of this request') end - - it 'should display a link for anyone to update the status of the request' do + + it 'should display a link for anyone to update the status of the request' do expect_anyone_link('Update the status of this request') end - + end - - describe 'if the request is not old and unclassified' do - - before do + + describe 'if the request is not old and unclassified' do + + before do assigns[:old_unclassified] = false end - - it 'should display a link for the request owner to update the status of the request' do + + it 'should display a link for the request owner to update the status of the request' do expect_owner_link('Update the status of this request') end - - it 'should not display a link for anyone to update the status of the request' do + + it 'should not display a link for anyone to update the status of the request' do expect_no_anyone_link('Update the status of this request') end - + end it 'should display a link for the request owner to request a review' do expect_owner_link('Request an internal review') end - + end |