Agile Web Development with Rails, Edition 4

8.4 Iteration C4: Functional Testing 8.2 Iteration C2: Add a Page Layout

8.3 Iteration C3: Use a Helper to Format the Price

Expected at least 1 element matching "span.price", found 0.
<0> expected to be
>=
<1>.

Traceback:
  /home/rubys/git/awdwr/edition4/checkdepot.rb:119:in `block in <class:DepotTest>'

Demonstrate helpers.

Format the price using a built-in helper.

edit app/views/store/index.html.erb
<% if notice %>
<p id="notice"><%= notice %></p>
<% end %>
 
<h1>Your Pragmatic Catalog</h1>
 
<% @products.each do |product| %>
  <div class="entry">
    <%= image_tag(product.image_url) %>
    <h3><%= product.title %></h3>
    <%= sanitize(product.description) %>
    <div class="price_line">
      <span class="price"><%= number_to_currency(product.price) %></span>
    </div>
  </div>
<% end %>

Show the results.

get /

Sprockets::Rails::Helper::AssetNotPrecompiled in Store#index

Showing /home/rubys/git/awdwr/edition4/work-42/depot/app/views/store/index.html.erb where line #9 raised:

Asset was not declared to be precompiled in production.
Add `Rails.application.config.assets.precompile += %w( cs.jpg )` to `config/initializers/assets.rb` and restart your server
Extracted source (around line #9):
7
8
9
10
11
12
              
<% @products.each do |product| %>
<div class="entry">
<%= image_tag(product.image_url) %>
<h3><%= product.title %></h3>
<%= sanitize(product.description) %>
<div class="price_line">

Rails.root: /home/rubys/git/awdwr/edition4/work-42/depot

Application Trace | Framework Trace | Full Trace

Request

Parameters:

None

Response

Headers:

None

8.4 Iteration C4: Functional Testing 8.2 Iteration C2: Add a Page Layout