aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration/errors_spec.rb
diff options
context:
space:
mode:
authorDavid Cabo <david@calibea.com>2011-10-13 00:29:51 +0200
committerDavid Cabo <david@calibea.com>2011-10-13 00:29:51 +0200
commitc8983b923e4dc7db9ba22156daaddd94d2b5ed4d (patch)
tree7741c3655fe5e3cbc90dd20a4626ac7acc1bf6b0 /spec/integration/errors_spec.rb
parenta29b3aaf0ae77af49d38813b62dddcb6889c1ebe (diff)
parente13127a8ebc8bf8379d92f778af5a2bb6931d80c (diff)
Merge branch 'release/0.4'0.4
Diffstat (limited to 'spec/integration/errors_spec.rb')
-rw-r--r--spec/integration/errors_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/integration/errors_spec.rb b/spec/integration/errors_spec.rb
new file mode 100644
index 000000000..c64ca79e8
--- /dev/null
+++ b/spec/integration/errors_spec.rb
@@ -0,0 +1,45 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe "When rendering errors" do
+
+ fixtures [ :info_requests,
+ :info_request_events,
+ :public_bodies,
+ :public_body_translations,
+ :users,
+ :raw_emails,
+ :outgoing_messages,
+ :incoming_messages,
+ :comments ]
+
+ before(:each) do
+ load_raw_emails_data(raw_emails)
+ ActionController::Base.consider_all_requests_local = false
+ end
+
+ after(:each) do
+ ActionController::Base.consider_all_requests_local = true
+ end
+
+ it "should render a 404 for unrouteable URLs" do
+ get("/frobsnasm")
+ response.code.should == "404"
+ response.body.should include("The page doesn't exist")
+ end
+ it "should render a 404 for users that don't exist" do
+ get("/user/wobsnasm")
+ response.code.should == "404"
+ end
+ it "should render a 404 for bodies that don't exist" do
+ get("/body/wobsnasm")
+ response.code.should == "404"
+ end
+ it "should render a 500 for general errors" do
+ ir = info_requests(:naughty_chicken_request)
+ # Set an invalid state for the request. Note that update_attribute doesn't run the validations
+ ir.update_attribute(:described_state, "crotchety")
+ get("/request/#{ir.url_title}")
+ response.code.should == "500"
+ end
+end
+