small medium large xlarge

13 Jun 2010, 13:52
Ulf Klose (5 posts)

Is the template missing? Did I just overlook it or is it really not mentioned in the book? (ePub, Beta4)


1) Failure: test_order_shipped(NotifierTest) [/test/functional/notifier_test.rb:17]: <”Notifier#order_shipped\r\n\r\n, find me in app/views/app/views/notifier/order_shipped.text.erb\r\n”> expected to be =~ </<td>1×<\/td>\s*<td>Programming Ruby 1.9<\/td>/>. `

My code is available through my GitHub account:

Thanks for your help. I don’t like the idea of continuing without all tests passing properly.

14 Jun 2010, 13:27
Sam Ruby (634 posts)

Very cool pushing your code to GitHub. Here is the missing template:

<h3>Pragmatic Order Shipped</h3>
  This is just to let you know that we've shipped your recent order:

  <tr><th colspan="2">Qty</th><th>Description</th></tr>
<%= render @order.line_items %>

I’ll correct this in the next beta.

17 Jun 2010, 13:11
Ulf Klose (5 posts)

Thanks for your answer.

I monitored this topic but didn’t get a notification. Intentionally?

After copying your code and running rake test again I got the following:

  1) Failure:
test_order_shipped(NotifierTest) [/test/functional/notifier_test.rb:17]:
<"<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\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</table>"> expected to be =~
</<td>1&times;<\/td>\s*<td>Programming Ruby 1.9<\/td>/>.

I updated my repository on GitHub.

17 Jun 2010, 17:47
Sam Ruby (634 posts)

That looks like a bug in Rails. In fact, it looks very similar to the one that they introduced and (I thought) fixed just prior to the release of beta 4: namely that the wrong format is used to determine which partial is used. In this case, _line_item.text.erb is used instead of _line_item.html.erb. I am not seeing that problem with the latest Rails, and hopefully a new beta or even a release candidate will be available in a few days.

As to notification, that’s not something I can answer, hopefully somebody else will chime in.

17 Jul 2013, 07:24
Eric Ritchey (1 post)

Hey Sam - I’m running into this exact problem with the AWDwR v4 book. Here’s my code:

1. line_items.yml
2. products.yml
3. orders.yml


_line_item.html.erb note: I added the <% if @editable %> section since this file is being reused in the left column of the depot app as well as the email (obviously, I don’t want to display an item decrementer in the email :) )

When I run rake test I get the following:

# Running tests:


Finished tests in 1.042280s, 48.9312 tests/s, 125.6860 assertions/s.

1) Failure:
OrderNotifierTest#test_received [/Users/eric/bin/bitbucket/depot/test/mailers/order_notifier_test.rb:14]:
Expected /1 x Programming Ruby 1.9/ to match "\\r\\n----==_mimepart_51e640f32eeb7_80353ff9fcc606d4875c5\\r\\nContent-Type: text/plain;\\r\\n charset=UTF-8\\r\\nContent-Transfer-Encoding: 7bit\\r\\n\\r\\n\\r\\n----==_mimepart_51e640f32eeb7_80353ff9fcc606d4875c5\\r\\nContent-Type: text/html;\\r\\n charset=UTF-8\\r\\nContent-Transfer-Encoding: 7bit\\r\\n\\r\\n\\r\\n----==_mimepart_51e640f32eeb7_80353ff9fcc606d4875c5--\\r\\n".

2) Failure:
OrderNotifierTest#test_shipped [/Users/eric/bin/bitbucket/depot/test/mailers/order_notifier_test.rb:22]:
Expected /1 x Programming Ruby 1.9/ to match "\\r\\n----==_mimepart_51e640f339af1_80353ff9fcc606d48769b\\r\\nContent-Type: text/plain;\\r\\n charset=UTF-8\\r\\nContent-Transfer-Encoding: 7bit\\r\\n\\r\\n\\r\\n----==_mimepart_51e640f339af1_80353ff9fcc606d48769b\\r\\nContent-Type: text/html;\\r\\n charset=UTF-8\\r\\nContent-Transfer-Encoding: 7bit\\r\\n\\r\\n<h3>Pragmatic Order Shipped</h3>\\r\\n<p>This is just to let you know that we've shipped your recent order:</p>\\r\\n<table border=\"0\" cellspacing=\"5\" cellpadding=\"5\">\\r\\n  <tr>\\r\\n    <th colspan=\"2\">Qty</th>\\r\\n    <th>Description</th>\\r\\n  </tr>\\r\\n  \\r\\n</table>\\r\\n----==_mimepart_51e640f339af1_80353ff9fcc606d48769b--\\r\\n".

3) Failure:
UserStoriesTest#test_buying_a_product [/Users/eric/bin/bitbucket/depot/test/integration/user_stories_test.rb:50]:
Expected: 0
Actual: 1

51 tests, 131 assertions, 3 failures, 0 errors, 0 skips

I’m not sure how obvious it is, but what I’ve deduced is that my _line_items.html.erb file (<%= render @order.line_items -%>) is returning as empty. I have verified this by puts "YOUR LINE_ITEMS: #{@line_items.inspect}" inside my order_notifier.rb’s received block, which returns as YOUR LINE_ITEMS: nil when i run rake test.

Any help would be welcome.


(hopefully markdown didn’t completely bork my code here)

UPDATE: This question on SO seems to present the same issue, but from what I can tell, my code is correect…

10 Aug 2017, 10:55
Wladislaw (1 post)

Just in case someone has the same problem, my problem was the wrong line_items.yml

  product: two
  cart: one

  product: ruby
  order: one

This is the right one, the “order” parameter was missing. Btw. i used the Agile Web Development with Rails 5. Just in case.

You must be logged in to comment