[rspec-users] should_receive twice and arguments

David Chelimsky dchelimsky at gmail.com
Sun Jan 13 08:00:16 EST 2008

On Jan 13, 2008 6:56 AM, Ivo Dancet <ivo.dancet at gmail.com> wrote:
> Hi all, I have a method calling Klass.create! two times with different
> arguments (this happens in a class reponsable for reading in a csv file)
> I want to test those like this:
> in one test: Klass.should_receive(:create!).with(:name => "foo").once
> in another: Klass.should_receive(:create!).with(:name => "foo2").once
> This doesn't work because the 'once' is only about the create! call,

Actually, that should work. 'once' is about the complete expectation
including the arguments. If this isn't working you've uncovered a bug.
Please report it to the lighthouse (http://rspec.lighthouseapp.com)
with specific examples we can run and the output you're getting.


> it doesn't use the arguments to make the call unique. Can I make this
> work another way (not only should_receive(:create!).twice, I want to
> test the arguments).
> Thanks for any feedback.
> Ivo
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list