Skip to content

Commit

Permalink
Make name of sample exception a bit more clear as to its purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyhaines committed Jan 29, 2012
1 parent 6fe4168 commit b92f2cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/rspec/mocks/mock_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ def @mock.method_with_default_argument(arg={}); end
end end


it "fails with nice message if passed Exception requires constructor arguments" do it "fails with nice message if passed Exception requires constructor arguments" do
class FancyError < RuntimeError class ErrorThatHasAConstructorTakingArguments < RuntimeError
def initialize(i_take_an_argument) def initialize(i_take_an_argument)
end end
end end


@mock.should_receive(:something).and_raise(FancyError) @mock.should_receive(:something).and_raise(ErrorThatHasAConstructorTakingArguments)
lambda { lambda {
@mock.something @mock.something
}.should raise_error(ArgumentError, "Errors raised by expectations cannot have constructors that take arguments. RSpec::Mocks::FancyError has a constructor requiring 1.") }.should raise_error(ArgumentError, "Errors raised by expectations cannot have constructors that take arguments. RSpec::Mocks::ErrorThatHasAConstructorTakingArguments has a constructor requiring 1.")
end end


it "raises RuntimeError with passed message" do it "raises RuntimeError with passed message" do
Expand Down

0 comments on commit b92f2cc

Please sign in to comment.