20 Jun 2014, 05:24
Generic-user-small

Jaimin pandya (2 posts)

I am reading Agile Web Developement with rails. I am using Ruby 1.9.3 and Rails 3.2.16.

When I run rake test command, i got following errors:

1) Failure: test_received(OrderNotifierTest) [/home/jaimin/rails3/work/depot/test/functional/order_notifier_test.rb:9]: Expected /1 x Programming Ruby 1.9/ to match “Dear Dave Thomas\r\n\r\nThank you for your recent order from The Pragmatic Store.\r\n\r\nYou ordered the following items:\r\n\r\n 1 x Programming Ruby 1.9\r\n\r\n\r\n\r\nWe’ll send you a separate e-mail when your order ships.\r\n\r\n”.

2) Failure: test_shipped(OrderNotifierTest) [/home/jaimin/rails3/work/depot/test/functional/order_notifier_test.rb:17]: Expected /1 x Programming Ruby 1.9/ to match “<h3>Pragmatic Order Shipped</h3>\r\n<p>\r\n This is just to let you know that we’ve shipped your recent order:\r\n</p>\r\n<table>\r\n <tr><th colspan="2">Qty</th><th>Description</th></tr>\r\n 1 x Programming Ruby 1.9\r\n\r\n\r\n</table>\r\n\r\n”.

I refer this link: http://stackoverflow.com/questions/17421097/rake-t… also but I can’t able to solve this error.

Code of order_notifier_test.rb:

require 'test_helper'

class OrderNotifierTest < ActionMailer::TestCase
    test "received" do
    mail = OrderNotifier.received(orders(:one))
    assert_equal "Pragmatic Store Order Confirmation", mail.subject
    assert_equal ["dave@example.org"], mail.to
    assert_equal ["depot@example.com"], mail.from
    assert_match /1 x Programming Ruby 1.9/, mail.body.encoded
  end

  test "shipped" do
     mail = OrderNotifier.shipped(orders(:one))
     assert_equal "Pragmatic Store Order Shipped", mail.subject
     assert_equal ["dave@example.org"], mail.to
     assert_equal ["depot@example.com"], mail.from
     assert_match /1 x Programming Ruby 1.9/, mail.body.encoded
   end
end

my shipped.text.erb is under app/views/order_notifier directory.

How can I solve this error?

20 Jun 2014, 06:46
Generic-user-small

Jaimin pandya (2 posts)

I have solved error.

  You must be logged in to comment