-
-
Save JonRowe/2c1200452672ffec0322 to your computer and use it in GitHub Desktop.
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
Failures: | |
1) should custom match false | |
Failure/Error: expect(true).to custom_match(false) | |
expected true to custom match false | |
# ./matcher_spec.rb:12:in `block (2 levels) in <top (required)>' | |
2) should custom match "another" | |
Failure/Error: expect("string").to custom_match("another") | |
expected "string" to custom match "another" | |
# ./matcher_spec.rb:15:in `block (2 levels) in <top (required)>' | |
Finished in 0.0006 seconds | |
2 examples, 2 failures |
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
Failures: | |
1) should custom match false | |
Failure/Error: expect(true).to custom_match(false) | |
expected true to custom match false | |
Diff: | |
@@ -1,2 +1,2 @@ | |
-[false] | |
+true | |
# ./matcher_spec.rb:12:in `block (2 levels) in <top (required)>' | |
2) should custom match "another" | |
Failure/Error: expect("string").to custom_match("another") | |
expected "string" to custom match "another" | |
# ./matcher_spec.rb:15:in `block (2 levels) in <top (required)>' | |
Finished in 0.0006 seconds | |
2 examples, 2 failures |
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
RSpec::Matchers.define :custom_match do |expected| | |
match do |actual| | |
actual == expected | |
end | |
diffable | |
end | |
describe do | |
example do | |
expect(true).to custom_match(false) | |
end | |
example do | |
expect("string").to custom_match("another") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment