aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration/request_controller_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-03-19 14:02:25 -0700
committerLouise Crow <louise.crow@gmail.com>2013-03-19 14:02:25 -0700
commitb394b67663916c865452cc784d8642f72a305be5 (patch)
tree63c92172fe7813e6354da0ead628ed2192ef0ee2 /spec/integration/request_controller_spec.rb
parent8d21293461ce4b564261686ab8d6460f5fe51259 (diff)
parentf83b917ec2c59da0ce7c27da19b740366da58419 (diff)
Merge branch 'release/0.8' into wdtk
Conflicts: app/controllers/admin_request_controller.rb app/views/contact_mailer/from_admin_message.rhtml
Diffstat (limited to 'spec/integration/request_controller_spec.rb')
-rw-r--r--spec/integration/request_controller_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/integration/request_controller_spec.rb b/spec/integration/request_controller_spec.rb
new file mode 100644
index 000000000..24667bdf1
--- /dev/null
+++ b/spec/integration/request_controller_spec.rb
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe RequestController, "when classifying an information request" do
+
+ describe 'when the request is internal' do
+
+ before(:each) do
+ @dog_request = info_requests(:fancy_dog_request)
+ # This should happen automatically before each test but doesn't with these integration
+ # tests for some reason.
+ ActionMailer::Base.deliveries = []
+ end
+
+ describe 'when logged in as the requestor' do
+
+ before :each do
+ @request_owner = @dog_request.user
+ visit signin_path
+ fill_in "Your e-mail:", :with => @request_owner.email
+ fill_in "Password:", :with => "jonespassword"
+ click_button "Sign in"
+ end
+
+ it "should send an email including the message" do
+ visit describe_state_message_path(:url_title => @dog_request.url_title,
+ :described_state => "requires_admin")
+ fill_in "Please tell us more:", :with => "Okay. I don't quite understand."
+ click_button "Submit status and send message"
+
+ response.should contain "Thank you! We'll look into what happened and try and fix it up."
+
+ deliveries = ActionMailer::Base.deliveries
+ deliveries.size.should == 1
+ mail = deliveries[0]
+ mail.body.should =~ /as needing admin/
+ mail.body.should =~ /Okay. I don't quite understand./
+ end
+ end
+ end
+end