diff options
author | louise <louise> | 2009-04-15 10:13:53 +0000 |
---|---|---|
committer | louise <louise> | 2009-04-15 10:13:53 +0000 |
commit | 79e569e6949405282efd3d9102c6b29283bbf199 (patch) | |
tree | 2570354096bf14b2ecc1198c695a23fbb0279f24 /spec/views/request/_after_actions.rhtml_spec.rb | |
parent | 4129caa82c34f6877688da6f6bbcdeaf2b2aabcc (diff) |
Making "update status" link and other text more consistent with the ability of anyone to update the status of an old unclassified request
Diffstat (limited to 'spec/views/request/_after_actions.rhtml_spec.rb')
-rw-r--r-- | spec/views/request/_after_actions.rhtml_spec.rb | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/spec/views/request/_after_actions.rhtml_spec.rb b/spec/views/request/_after_actions.rhtml_spec.rb index 7893d2e49..a92ef2dda 100644 --- a/spec/views/request/_after_actions.rhtml_spec.rb +++ b/spec/views/request/_after_actions.rhtml_spec.rb @@ -18,17 +18,64 @@ describe 'when displaying actions that can be taken with regard to a request' do render :partial => 'request/after_actions' end - def expect_owner_link(text) + def expect_owner_div do_render - response.should have_tag('div#owner_actions') do - with_tag('a', :text => text) - end + 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 - 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') + 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 + assigns[:old_unclassified] = true + end + + 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 + expect_anyone_link('Update the status of this request') + end + end + 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 + 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 + 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 |