Last active
August 29, 2015 13:55
-
-
Save aspiers/8786515 to your computer and use it in GitHub Desktop.
rspec expectations bug?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative 'spec_helper' | |
# The following fails with output which is not as helpful as it | |
# could be: | |
# | |
# expected RuntimeError, got #<RuntimeError: foo> with backtrace: | |
# | |
# It would be much better if it said something like: | |
# | |
# expected: #<RuntimeError: bar> | |
# got: #<RuntimeError: foo> | |
# with backtrace: | |
# | |
# which includes the expected message, not just the obtained message. | |
# The alignment makes it a lot easier to see where the messages don't match up. | |
# Also, if either of the messages were multi-line, a unified diff would be useful. | |
describe "rspec-expectations bug?" do | |
it "should fail showing the difference in error messages" do | |
expect { raise RuntimeError, "foo" }.to raise_error(RuntimeError, "bar") | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment