Skip to content

Instantly share code, notes, and snippets.

@fnando
Created May 29, 2013 10:44
Show Gist options
  • Select an option

  • Save fnando/5669437 to your computer and use it in GitHub Desktop.

Select an option

Save fnando/5669437 to your computer and use it in GitHub Desktop.
RSpec 2.14.0.rc1 introduces message expectation through the expect method. To be honest, I still prefer the classic syntax in this case, since it's easier to format the code in multiple lines (readability <3).
# Classic syntax
some_object
.should_receive(:some_method)
.with(:a, :b, :c)
.and_return(:d)
# expect syntax
expect(some_object).to receive(:some_method).with(:a, :b, :c).and_return(:d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment