Skip to content
Browse files

Failing spec and patch for ticket 830

[#830 state:resolved milestone:'Next Release']
  • Loading branch information...
1 parent 67d8d84 commit 1b51a79fd7a7f2a8baea865ce0e8ca8b4a5bf1e3 @kerryb kerryb committed with May 28, 2009
View
2 lib/spec/mocks/errors.rb
@@ -1,6 +1,6 @@
module Spec
module Mocks
- class MockExpectationError < StandardError
+ class MockExpectationError < Exception
end
class AmbiguousReturnError < StandardError
View
5 spec/spec/mocks/bug_report_10263_spec.rb
@@ -7,7 +7,10 @@
@mock.should_receive(:msg) do |b|
b.should be_true #this call exposes the problem
end
- @mock.msg(false) rescue nil
+ begin
+ @mock.msg(false)
+ rescue Exception
+ end
end
specify "then the next example should behave as expected instead of saying" do
View
21 spec/spec/mocks/bug_report_830_spec.rb
@@ -0,0 +1,21 @@
+require File.dirname(__FILE__) + '/../../spec_helper.rb'
+
+module Spec
+ module Mocks
+ describe 'Calling a method that catches StandardError' do
+ class Foo
+ def self.foo
+ bar
+ rescue StandardError
+ end
+ end
+
+ it 'still reports mock failures' do
+ Foo.should_not_receive :bar
+ lambda do
+ Foo.foo
+ end.should raise_error(MockExpectationError)
+ end
+ end
+ end
+end
View
2 spec/spec/mocks/options_hash_spec.rb
@@ -8,7 +8,7 @@ module Mocks
mock = Spec::Mocks::Mock.new("a mock")
mock.should_receive(:message, :expected_from => "/path/to/blah.ext:37")
mock.rspec_verify
- rescue => e
+ rescue Exception => e
ensure
e.backtrace.to_s.should =~ /\/path\/to\/blah.ext:37/m
end

0 comments on commit 1b51a79

Please sign in to comment.
Something went wrong with that request. Please try again.