Skip to content

Instantly share code, notes, and snippets.

@danielwestendorf
Created December 12, 2017 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielwestendorf/84058a8b458a4f3cfe87e13bd8b9ca9c to your computer and use it in GitHub Desktop.
Save danielwestendorf/84058a8b458a4f3cfe87e13bd8b9ca9c to your computer and use it in GitHub Desktop.
# spec/support/have_size.rb
require "rspec/expectations"
RSpec::Matchers.define :have_size do |expected|
match do |actual|
actual.size == expected
end
failure_message do |actual|
"expected #{actual.inspect} to have size of #{expected}, but was #{actual.size}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment