Skip to content

Instantly share code, notes, and snippets.

@rojotek
Created September 4, 2012 07:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rojotek/3618228 to your computer and use it in GitHub Desktop.
Save rojotek/3618228 to your computer and use it in GitHub Desktop.
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 = "should be less than #{expected}"
result += " and greater than #{@low_value}" if @low_value
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment