Created
September 4, 2012 07:58
-
-
Save rojotek/3618249 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
RSpec::Matchers.define :be_less_than do |expected| | |
match do |actual| | |
result = actual<expected | |
result &&=actual>@low_value unless @low_value.nil? | |
result | |
end | |
chain :and_greater_than do |low_value| | |
@low_value=low_value | |
end | |
description do | |
result = "be less than #{expected}" | |
result += " and greater than #{@low_value}" if @low_value | |
result | |
end | |
failure_message_for_should do |actual| | |
"expected #{actual} "+description | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment