aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/request_controller_spec.rb52
-rw-r--r--spec/fixtures/info_requests.yml6
-rw-r--r--spec/fixtures/outgoing_messages.yml20
3 files changed, 51 insertions, 27 deletions
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 5986e8fd1..3d742f7e0 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -25,7 +25,7 @@ end
describe RequestController, "when listing all requests" do
integrate_views
- fixtures :info_requests
+ fixtures :info_requests, :outgoing_messages
it "should be successful" do
get :list
@@ -161,31 +161,31 @@ describe RequestController, "when viewing an individual response" do
end
end
-describe RequestController, "when classifying an individual response" do
- integrate_views
- fixtures :info_requests, :public_bodies, :users, :incoming_messages, :outgoing_messages # all needed as integrating views
-
- it "should require login" do
- post :show_response, :incoming_message => { :contains_information => true }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_classify => 1
- post_redirect = PostRedirect.get_last_post_redirect
- response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token)
- end
-
- it "should not classify response if logged in as wrong user" do
- session[:user_id] = users(:silly_name_user).id
- post :show_response, :incoming_message => { :contains_information => true }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_classify => 1
- response.should render_template('user/wrong_user')
- end
-
- it "should successfully classify response if logged in as user controlling request" do
- incoming_messages(:useless_incoming_message).user_classified.should == false
- session[:user_id] = users(:bob_smith_user).id
- post :show_response, :incoming_message => { :contains_information => true }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_classify => 1
- response.should redirect_to(:controller => 'request', :action => 'show', :id => info_requests(:fancy_dog_request))
- incoming_messages(:useless_incoming_message).reload
- incoming_messages(:useless_incoming_message).user_classified.should == true
- end
-end
+#describe RequestController, "when classifying an individual response" do
+# integrate_views
+# fixtures :info_requests, :public_bodies, :users, :incoming_messages, :outgoing_messages # all needed as integrating views
+#
+# it "should require login" do
+# post :show_response, :incoming_message => { :contains_information => true }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_classify => 1
+# post_redirect = PostRedirect.get_last_post_redirect
+# response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token)
+# end
+#
+# it "should not classify response if logged in as wrong user" do
+# session[:user_id] = users(:silly_name_user).id
+# post :show_response, :incoming_message => { :contains_information => true }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_classify => 1
+# response.should render_template('user/wrong_user')
+# end
+#
+# it "should successfully classify response if logged in as user controlling request" do
+# incoming_messages(:useless_incoming_message).user_classified.should == false
+# session[:user_id] = users(:bob_smith_user).id
+# post :show_response, :incoming_message => { :contains_information => true }, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message), :submitted_classify => 1
+# response.should redirect_to(:controller => 'request', :action => 'show', :id => info_requests(:fancy_dog_request))
+# incoming_messages(:useless_incoming_message).reload
+# incoming_messages(:useless_incoming_message).user_classified.should == true
+# end
+#end
describe RequestController, "when sending a followup message" do
integrate_views
diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml
index 53a325caa..fbd964603 100644
--- a/spec/fixtures/info_requests.yml
+++ b/spec/fixtures/info_requests.yml
@@ -5,6 +5,9 @@ fancy_dog_request:
updated_at: 2007-10-11 18:15:57
public_body_id: 2
user_id: 1
+ described_state: awaiting_response
+ awaiting_description: true
+ described_last_incoming_message_id: 1
naughty_chicken_request:
id: 103
title: How much public money is wasted on breeding naughty chickens?
@@ -12,5 +15,8 @@ naughty_chicken_request:
updated_at: 2007-10-13 18:15:57
public_body_id: 2
user_id: 1
+ described_state: awaiting_response
+ awaiting_description: false
+ described_last_incoming_message_id: nil
diff --git a/spec/fixtures/outgoing_messages.yml b/spec/fixtures/outgoing_messages.yml
index 2f72392bd..d4e6bdc13 100644
--- a/spec/fixtures/outgoing_messages.yml
+++ b/spec/fixtures/outgoing_messages.yml
@@ -10,7 +10,25 @@ useless_outgoing_message:
\r\n\
Thanks!\r\n\
\r\n\
- Francis\r\n"
+ Bob\r\n"
last_sent_at: 2007-10-25 10:41:12.686264
created_at: 2007-10-12 01:56:58.586598
+silly_outgoing_message:
+ id: 2
+ info_request_id: 103
+ message_type: initial_request
+ status: sent
+ updated_at: 2007-10-14 01:56:58.586598
+ body: "Hey you!\r\n\
+ \r\n\
+ I would like a complete breakdown of public sector\r\n\
+ spending on chickens by type of chicken. Specifically\r\n
+ I would like to know how much is spent on good \r\n
+ chickens and how much on naughty chickens.\r\n
+ \r\n\
+ Lovingly,\r\n\
+ \r\n\
+ Bob\r\n"
+ last_sent_at: 2007-10-14 10:41:12.686264
+ created_at: 2007-10-14 01:56:58.586598