13 Jun 2010, 13:52
_dsc0355_pragsmall

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: http://github.com/ulfklose/depot

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

14 Jun 2010, 13:27
Samr_small_pragsmall

Sam Ruby (584 posts)

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

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

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

I’ll correct this in the next beta.

17 Jun 2010, 13:11
_dsc0355_pragsmall

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
Samr_small_pragsmall

Sam Ruby (584 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
Generic-user-small

Eric Ritchey (1 post)

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

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

Mailers
order_notifier_test.rb

_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:

.................FF...............................F

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.

Thanks

(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…

  You must be logged in to comment