Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add spec for bypass_rescue

  • Loading branch information...
commit e028626ceb6b5c394da9cac384bc42ca9b4f6b32 1 parent a550d08
@dchelimsky dchelimsky authored
Showing with 14 additions and 3 deletions.
  1. +14 −3 spec/rspec/rails/example/controller_example_group_spec.rb
View
17 spec/rspec/rails/example/controller_example_group_spec.rb
@@ -28,15 +28,15 @@ module RSpec::Rails
end
end
- describe "with explicit subject" do
- it "should use the specified subject instead of the controller" do
+ context "with explicit subject" do
+ it "uses the specified subject instead of the controller" do
group.subject { 'explicit' }
example = group.new
example.subject.should == 'explicit'
end
end
- describe "with anonymous controller" do
+ describe "#controller" do
before do
group.class_eval do
controller(Class.new) { }
@@ -60,5 +60,16 @@ module RSpec::Rails
example.foos_url.should eq('http://test.host/foos')
end
end
+
+ describe "#bypass_rescue" do
+ it "overrides the rescue_with_handler method on the controller to raise submitted error" do
+ example = group.new
+ example.instance_variable_set("@controller", Class.new { def rescue_with_handler(e); end }.new)
+ example.bypass_rescue
+ expect do
+ example.controller.rescue_with_handler(RuntimeError.new("foo"))
+ end.to raise_error("foo")
+ end
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.