diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-04 15:03:02 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-04 15:03:02 +0100 |
commit | a885764b65916020d9182073b38f6951a20d4b8c (patch) | |
tree | 0988651c144b65a8e46b28b376b2e72a5947d934 /spec/views/request/_after_actions.html.erb_spec.rb | |
parent | eb1c465162420ad62c16dccb983cb28aa89a4639 (diff) | |
parent | a919141992a40599f99b32bd4a8312a0009f3f7a (diff) |
Merge branch 'release/0.11'0.11.0.3
Diffstat (limited to 'spec/views/request/_after_actions.html.erb_spec.rb')
-rw-r--r-- | spec/views/request/_after_actions.html.erb_spec.rb | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/spec/views/request/_after_actions.html.erb_spec.rb b/spec/views/request/_after_actions.html.erb_spec.rb new file mode 100644 index 000000000..ae398f4ce --- /dev/null +++ b/spec/views/request/_after_actions.html.erb_spec.rb @@ -0,0 +1,93 @@ +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', + :url_name => 'test_public_body') + @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, + :is_external? => false, + :public_body => @mock_body, + :comments_allowed? => true, + :url_title => 'test_request', + :all_can_view? => true) + assign :info_request, @mock_request + end + + describe 'if the request is old and unclassified' do + + before do + assign :old_unclassified, true + end + + it 'should not display a link for the request owner to update the status of the request' do + render :partial => 'request/after_actions' + response.should have_selector('div#owner_actions') do |div| + div.should_not have_selector('a', :content => 'Update the status of this request') + end + end + + it 'should display a link for anyone to update the status of the request' do + render :partial => 'request/after_actions' + response.should have_selector('div#anyone_actions') do |div| + div.should have_selector('a', :content => 'Update the status of this request') + end + end + + end + + describe 'if the request is not old and unclassified' do + + before do + assign :old_unclassified, false + end + + it 'should display a link for the request owner to update the status of the request' do + render :partial => 'request/after_actions' + response.should have_selector('div#owner_actions') do |div| + div.should have_selector('a', :content => 'Update the status of this request') + end + end + + it 'should not display a link for anyone to update the status of the request' do + render :partial => 'request/after_actions' + response.should have_selector('div#anyone_actions') do |div| + div.should_not have_selector('a', :content => 'Update the status of this request') + end + end + + end + + it 'should display a link for the request owner to request a review' do + render :partial => 'request/after_actions' + response.should have_selector('div#owner_actions') do |div| + div.should have_selector('a', :content => 'Request an internal review') + end + end + + describe 'if the request is viewable by all' do + + it 'should display the link to download the entire request' do + render :partial => 'request/after_actions' + response.should have_selector('div#anyone_actions') do |div| + div.should have_selector('a', :content => 'Download a zip file of all correspondence') + end + end + end + + describe 'if the request is not viewable by all' do + + it 'should not display the link to download the entire request' do + @mock_request.stub!(:all_can_view?).and_return(false) + render :partial => 'request/after_actions' + response.should have_selector('div#anyone_actions') do |div| + div.should_not have_selector('a', :content => 'Download a zip file of all correspondence') + end + end + end + +end |