Skip to content

Instantly share code, notes, and snippets.

@ramfjord
Last active July 14, 2016 01:23
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 ramfjord/1f7a9f3809d644563994b811fb375487 to your computer and use it in GitHub Desktop.
Save ramfjord/1f7a9f3809d644563994b811fb375487 to your computer and use it in GitHub Desktop.
Rspec varargs argument matching
# Actual test
it "prefixes each of it's locks with :prefix:" do
expect(ZookeeperLocker).to receive(:lock_no_retry)
.with(start_with("hello"))
lock_for_time_range "hello", @window do
# nothing
end
end
# Failure message
Failure/Error: lock_for_time_range "hello", @window do
<ZookeeperLocker (class)> received :lock_no_retry with unexpected arguments
expected: (start with "hello")
got: ("hello_20160711182245", "hello_20160712182245", "hello_20160713182245")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment