_spec.rb
context 'find discount coupon' do
it 'if coupon suitable for use' do
coupon = Factory(:standart_discount_coupon)
DiscountCoupon.find_discount_coupon(coupon.coupon_no).should eql({:success => true, :error => nil, :coupon_id => coupon.id })
end
end
我有这个测试,当我运行它时,我遇到了这个错误。
1) DiscountCoupon find discount coupon if coupon suitable for use
Failure/Error: DiscountCoupon.find_discount_coupon(coupon.coupon_no).should eql({:success => true, :error => nil, :coupon_id => coupon.id })
expected: {:success=>true, :error=>nil, :coupon_id=>1060}
got: {:success=>true, :error=>nil, :coupon_id=>1046}
(compared using eql?)
Diff:
@@ -1,4 +1,4 @@
-:coupon_id => 1060,
+:coupon_id => 1046,
:error => nil,
:success => true
为什么 copon_id 不同?