I put an expectation test, but it complains two things are different
when it prints it out in the error in the exact same way:
http://pastie.org/618481
or below:
## the test
describe ".process_aftersale" do
before do
@orders = [Order.make, Order.make]
Order.stub!(:paid).and_return(@orders)
@orders.stub!(:updated_on).and_return(@orders)
end
....
it "should send 1 week after sale letters" do
@orders.should_receive(:updated_on).once.with([1.week.ago])
Order.process_aftersale
end
...
end
## The error - note that the dates are the same
1)
Spec::Mocks::MockExpectationError in 'Order.process_aftersale should
send 1 week after sale letters'
#<Order:0xb4e8b3a4>#<Order:0xb4e69448> expected :updated_on with
([Wed, 09 Sep 2009 14:59:59 HKT +08:00]) but received it with ([Wed,
09 Sep 2009 14:59:59 HKT +08:00])
./spec/models/order_spec.rb:42:
## the method in Order
def self.process_aftersale
self.paid.updated_on(1.week.ago).each do |o|
MailingsWorker.asynch_deliver_order_aftersale_to_inquire(:order_id
=> o.id)
end
end
==============
I may be doing things wrong, so please let me know if I am.
Thanks!
Ramon Tayag
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users