Note that there are some explanatory texts on larger screens.

plurals
  1. POActionController::RoutingError: No route matches
    primarykey
    data
    text
    <p>I am a bit of a freshman in rails, so please bear with me. I get a routing error on my tests. The tests are as follwoing:</p> <pre><code>require 'spec_helper' describe "ProducerPages" do subject { page } describe "profile page" do @producer = Producer.create(name:"Example Producer", email: "producer@example.com", password: "foobar", password_confirmation: "foobar") before { visit producer_path(@producer) } it { should have_selector('h1', text: producer.name) } it { should have_selector('title', text: producer.name) } end end </code></pre> <p>and the failure produced is:</p> <pre><code>Failures: 1) ProducerPages profile page Failure/Error: before { visit producer_path(@producer) } ActionController::RoutingError: No route matches {:action=&gt;"show", :controller=&gt;"producers", :id=&gt;nil} # ./spec/requests/producer_pages_spec.rb:14:in `block (3 levels) in &lt;top (required)&gt;' </code></pre> <p>It looks, I do something wrong with creating the producer instance variable. I tried to make that a normal variable, but then I get this error: </p> <pre><code> 1) ProducerPages profile page Failure/Error: before { visit producer_path(producer) } ActionController::RoutingError: No route matches {:action=&gt;"show", :controller=&gt;"producers", :id=&gt;#&lt;Producer id: nil, name: "Example Producer", email: "producer@example.com", created_at: nil, updated_at: nil, password_digest: "$2a$04$pXAEklj4nzYe48ojR5Ps/Oh8Ea9.QqKOajYBD2Rv0mQ9...", remember_token: nil, admin: false, oid: nil, contact_name: nil, street: nil, postal_code: nil, city: nil, country: nil, url: nil, telephone: nil, cellular: nil, type: "Producer", producer_id: nil, client_key: nil, product_count: 0&gt;} # ./spec/requests/producer_pages_spec.rb:14:in `block (3 levels) in &lt;top (required)&gt;' </code></pre> <p>the routes.rb file contains</p> <pre><code> resources :producers </code></pre> <p>What am I doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload