Esad Hajdarevic
2007-Feb-20 21:20 UTC
[rspec-users] having should_receive expectation for things that happen in setup
Hi! The following example doesn''t work for me: http://pastie.caboo.se/41732 However, if the call to msg() happens in the specify block after the expecation and not in the setup, it will pass. Why is this? I thought the setup method was there to actually ''construct'' the context and the specifications are some kind of "postconditions" that only need to be validated after that - am I thinking wrong here? Greetings, Esad
David Chelimsky
2007-Feb-20 22:21 UTC
[rspec-users] having should_receive expectation for things that happen in setup
should_receive sets up expectations for things that will happen subsequently. In your example, foo.msg gets called before foo.should_receive(:msg) Make sense? On 2/20/07, Esad Hajdarevic <esad at esse.at> wrote:> Hi! > > The following example doesn''t work for me: http://pastie.caboo.se/41732 > > However, if the call to msg() happens in the specify block after the > expecation and not in the setup, it will pass. > > Why is this? I thought the setup method was there to actually > ''construct'' the context and the specifications are some kind of > "postconditions" that only need to be validated after that - am I > thinking wrong here? > > Greetings, > > Esad > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >