Hi there,
Google didn't yield anything useful, so here I am. This is on a
legacy project: Rails 2.3.14, rspec 1.3.2, rspec-rails 1.3.4 :-/
I've got a before(:each) setting up AR instances, so that I end up
with a @product assign.
Then within a context, one of my "it" descriptions goes:
money = Money.new(5_00, 'EUR')
fd = double('FlashSaleDiscount', :sale_total_cents =>
money.cents)
Rails.logger.debug '1>' * 70
@product.should_receive(:active_flash_sale_discount).and_return(fd)
@product.min_money(:force).should == money
Rails.logger.debug '<1' * 70
But when I run this, @product's *actual* active_flash_sale_discount
method is called, not the stubbed version used by the should_receive
expectation.
Another thing that confuses me is that the before(:each) AR-creating
code is, according to logs, triggered *after* the first
Rails.logger.debug call. Is there some lazy evaluation stuff I'm not
aware of in there? As for the final call, it doesn't show up in my
logs since the should fails.
This test code used to work. I have no idea why it suddenly went dead.
I thought this might be due to my running it through spork and guard,
but reverting back to a bare-bones "spec spec/models/product_spec.rb"
CLI had the exact same results.
Any help appreciated!
Thanks,
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rspec?hl=en.