aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration/view_request_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-08-01 14:53:10 +0100
committerLouise Crow <louise.crow@gmail.com>2013-09-16 12:25:23 +0100
commite53e0a0ccbb4695dbbb01a56598b7c832a9c5a0c (patch)
treeee5c9260100aaa2dd87f7d3e0057aa16e230f2ce /spec/integration/view_request_spec.rb
parentb8965db2ed79e5b79e77716371de02a0297d425e (diff)
Refactor some common setup steps in integration tests into a DSL.
Add a failing test for what should happen on request hiding.
Diffstat (limited to 'spec/integration/view_request_spec.rb')
-rw-r--r--spec/integration/view_request_spec.rb29
1 files changed, 22 insertions, 7 deletions
diff --git a/spec/integration/view_request_spec.rb b/spec/integration/view_request_spec.rb
index 3d646cfe7..79453e4c2 100644
--- a/spec/integration/view_request_spec.rb
+++ b/spec/integration/view_request_spec.rb
@@ -1,4 +1,5 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+require File.expand_path(File.dirname(__FILE__) + '/alaveteli_dsl')
describe "When viewing requests" do
@@ -7,18 +8,32 @@ describe "When viewing requests" do
end
it "should not make endlessly recursive JSON <link>s" do
- @dog_request = info_requests(:fancy_dog_request)
- get "request/#{@dog_request.url_title}?unfold=1"
- response.body.should_not include("dog?unfold=1.json")
- response.body.should include("dog.json?unfold=1")
+ unregistered = without_login
+ unregistered.browses_request('why_do_you_have_such_a_fancy_dog?unfold=1')
+ unregistered.response.body.should_not include("dog?unfold=1.json")
+ unregistered.response.body.should include("dog.json?unfold=1")
end
it 'should not raise a routing error when making a json link for a request with an
"action" querystring param' do
- @dog_request = info_requests(:fancy_dog_request)
- get "request/#{@dog_request.url_title}?action=add"
- response.should be_success
+ unregistered = without_login
+ unregistered.browses_request('why_do_you_have_such_a_fancy_dog?action=add')
end
+ context 'when a response is hidden' do
+
+ before do
+ useless_message = incoming_messages(:useless_incoming_message)
+ useless_message.prominence = 'hidden'
+ useless_message.save!
+ end
+
+ it 'should show a hidden notice to an unregistered user' do
+ unregistered = without_login
+ response = unregistered.browses_request('why_do_you_have_such_a_fancy_dog')
+ response.body.should include("This message has been hidden.")
+ end
+
+ end
end