Created
May 13, 2014 19:03
-
-
Save koriroys/531c84e1491fe42b3aaa to your computer and use it in GitHub Desktop.
rspec boolean matcher
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 'rspec/expectations' | |
RSpec::Matchers.define :be_boolean do | |
match do |actual| | |
[true, false].include? actual | |
end | |
failure_message_for_should do |actual| | |
"expected that #{actual.inspect} would be a boolean(true or false)" | |
end | |
failure_message_for_should do |actual| | |
"expected that #{actual.inspect} would be not be a boolean(true or false)" | |
end | |
description do | |
"be a boolean(true or false)" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment