diff options
Diffstat (limited to 'spec/views/request/_describe_state.rhtml_spec.rb')
-rw-r--r-- | spec/views/request/_describe_state.rhtml_spec.rb | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/spec/views/request/_describe_state.rhtml_spec.rb b/spec/views/request/_describe_state.rhtml_spec.rb index 306f70060..ebb1d5a91 100644 --- a/spec/views/request/_describe_state.rhtml_spec.rb +++ b/spec/views/request/_describe_state.rhtml_spec.rb @@ -6,6 +6,11 @@ describe 'when showing the form for describing the state of a request' do do_render response.should have_tag("input[type=radio][value=#{value}]") end + + def expect_no_radio_button(value) + do_render + response.should_not have_tag("input[type=radio][value=#{value}]") + end def do_render render :partial => 'request/describe_state', :locals => {:id_suffix => '1'} @@ -17,17 +22,22 @@ describe 'when showing the form for describing the state of a request' do assigns[:info_request] = @mock_request end - describe 'if showing the form to a regular user' do + describe 'if the user is a regular user' do before do assigns[:is_owning_user] = false end + it 'should not show the form' do + do_render + response.should_not have_tag('form') + end + it 'should give a link to login' do do_render response.should have_tag('a', :text => 'sign in') end - + end describe 'if showing the form to the user owning the request' do @@ -49,7 +59,31 @@ describe 'when showing the form for describing the state of a request' do it 'should show a radio button to set the status to "waiting clarification"' do expect_radio_button('waiting_clarification') end + + it 'should not show a radio button to set the status to "internal_review"' do + expect_no_radio_button('internal_review') + end + + end + describe 'when the user has asked to update the status of the request' do + + before do + assigns[:update_status] = true + end + + it 'should show a radio button to set the status to "internal_review"' do + expect_radio_button('internal_review') + end + + it 'should show a radio button to set the status to "requires_admin"' do + expect_radio_button('requires_admin') + end + + it 'should show a radio button to set the status to "user_withdrawn"' do + expect_radio_button('user_withdrawn') + end + end describe 'when the request is in internal review' do @@ -68,6 +102,9 @@ describe 'when showing the form for describing the state of a request' do end end + + describe 'when request is awaiting a description and the user has not asked to update the status' do + end it 'should show a radio button to set the status to "gone postal"' do expect_radio_button('gone_postal') @@ -93,5 +130,13 @@ describe 'when showing the form for describing the state of a request' do expect_radio_button('error_message') end + it 'should not show a radio button to set the status to "requires_admin"' do + expect_no_radio_button('requires_admin') + end + + it 'should not show a radio button to set the status to "user_withdrawn"' do + expect_no_radio_button('user_withdrawn') + end + end end
\ No newline at end of file |