psyho / bogus

Fake library for Ruby
Other
359 stars 14 forks source link

Add support for checking arguments with proc #17

Closed paneq closed 11 years ago

paneq commented 11 years ago

RSpec lets you do this:

library.should_receive(:checkout).with{|c| c.bytesize == 9 }.and_return(:checked_out)

Would be cool to have it supported in bogus:

describe Library do
  it "does something" do
    library = Library.new
    stub(library).checkout(with{|c| c.bytesize == 9 }) { :checked_out }
    library.checkout("some book").should == :checked_out
  end
end
wrozka commented 11 years ago

Good idea, I like the with api, we'll implement something like this soon.

paneq commented 11 years ago

@wrozka Good to hear it :)

paneq commented 11 years ago

Ship it ! :+1:

psyho commented 11 years ago

Shipped :)