> -----Original Message-----
> From: rails-bounces@lists.rubyonrails.org
> [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Lindsay Boyd
> Sent: Wednesday, February 15, 2006 2:02 PM
> To: rails@lists.rubyonrails.org
> Subject: [Rails] First unit test fails
>
>
> I''ve just started working through ''Agile''
chapter 12
> ''Testing''. I''ve followed the steps carefully,
setting up a
> fixture and unit test to check the creation of an order. When
> I run the test I get the following:
>
> Loaded suite test/unit/order_test
> Started
> F
> Finished in 0.108008 seconds.
>
> 1) Failure:
> test_create(OrderTest) [test/unit/order_test.rb:17]:
> <"Wed Feb 15 12:56:26 GMT 2006"> expected but was
> <Wed Feb 15 12:56:26 GMT 2006>.
>
> 1 tests, 6 assertions, 1 failures, 0 errors
Looks like you''re comparing a string against a Time object (note the
quotes in the expected value, and the lack of quotes in the actual
value). Take a look at p. 145 (under Create and Read), where they talk
about _before_type_cast.
Me? I just use the .to_s method.
Regards,
Dan