Last active
August 29, 2015 14:13
-
-
Save myronmarston/9032b943b2f2bc181034 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| Using `an_error_other_than` as an argument to `raise_error` | |
| failing (FAILED - 1) | |
| passing | |
| Failures: | |
| 1) Using `an_error_other_than` as an argument to `raise_error` failing | |
| Failure/Error: expect { | |
| expected an error other than SyntaxError, got #<SyntaxError: SyntaxError> with backtrace: | |
| # ./spec/raise_error_spec.rb:12:in `block (3 levels) in <top (required)>' | |
| # ./spec/raise_error_spec.rb:11:in `block (2 levels) in <top (required)>' | |
| # ./spec/raise_error_spec.rb:11:in `block (2 levels) in <top (required)>' | |
| Finished in 0.00248 seconds (files took 0.11564 seconds to load) | |
| 2 examples, 1 failure | |
| Failed examples: | |
| rspec ./spec/raise_error_spec.rb:10 # Using `an_error_other_than` as an argument to `raise_error` failing |
This file contains hidden or 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
| RSpec::Matchers.define_negated_matcher :an_error_other_than, :an_instance_of | |
| RSpec.describe "Using `an_error_other_than` as an argument to `raise_error`" do | |
| example "passing" do | |
| expect { | |
| raise ArgumentError | |
| }.to raise_error(an_error_other_than(SyntaxError)) | |
| end | |
| example "failing" do | |
| expect { | |
| raise SyntaxError | |
| }.to raise_error(an_error_other_than(SyntaxError)) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, it's raising a
GH::Errorbut should not raise aGH::TokenInvalid, which is a subclass ofGH::Errorso just checking for that wouldn't really work.