Rake test fail assert_match

33 views
Skip to first unread message

Jaimin Pandya

unread,
Jun 19, 2014, 9:55:58 AM6/19/14
to rubyonra...@googlegroups.com
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-test-fail-assert-match
also but I can't able to solve this error.

I have attached order_notifier_test.rb, Please find it.

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

How can I solve this error?

Kind regards.

Attachments:
http://www.ruby-forum.com/attachment/9819/order_notifier_test.rb


--
Posted via http://www.ruby-forum.com/.

Jason Fleetwood-Boldt

unread,
Jun 19, 2014, 12:33:15 PM6/19/14
to rubyonra...@googlegroups.com


Put a debugger in (use binding or debugger for Ruby < 1.9; use byebug for Ruby 2.0) before your test failure and execute those RegExp commands on the console while you have the values in memory.

You probably have just a few characters off, or a whitespace character that is messing up the match.
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c7c8434e736944d8fa1f5086d95ba418%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
>

Jaimin Pandya

unread,
Jun 20, 2014, 2:53:19 AM6/20/14
to rubyonra...@googlegroups.com
Jason Fb wrote in post #1150232:
> Put a debugger in (use binding or debugger for Ruby < 1.9; use byebug
> for Ruby 2.0) before your test failure and execute those RegExp commands
> on the console while you have the values in memory.
>
> You probably have just a few characters off, or a whitespace character
> that is messing up the match.

Thank you for your reply. I solved that error.

Kind regards
Reply all
Reply to author
Forward
0 new messages