aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration/request_controller_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/request_controller_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/request_controller_spec.rb')
-rw-r--r--spec/integration/request_controller_spec.rb17
1 files changed, 7 insertions, 10 deletions
diff --git a/spec/integration/request_controller_spec.rb b/spec/integration/request_controller_spec.rb
index 9e585448b..f5de692b8 100644
--- a/spec/integration/request_controller_spec.rb
+++ b/spec/integration/request_controller_spec.rb
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+require File.expand_path(File.dirname(__FILE__) + '/alaveteli_dsl')
describe RequestController, "when classifying an information request" do
@@ -16,26 +17,22 @@ describe RequestController, "when classifying an information request" do
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"
+ @bob = login(:bob_smith_user)
end
it "should send an email including the message" do
- visit describe_state_message_path(:url_title => @dog_request.url_title,
+ @bob.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"
+ @bob.fill_in "Please tell us more:", :with => "Okay. I don't quite understand."
+ @bob.click_button "Submit status and send message"
- response.should contain "Thank you! We'll look into what happened and try and fix it up."
+ @bob.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./
+ mail.body.should =~ /Okay. I don't quite understand./
end
end
end