私はレールの初心者なので、ご容赦ください。テストでルーティング エラーが発生します。テストは次のとおりです。
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
生成される障害は次のとおりです。
Failures:
  1) ProducerPages profile page
     Failure/Error: before { visit producer_path(@producer) }
     ActionController::RoutingError:
       No route matches {:action=>"show", :controller=>"producers", :id=>nil}
     # ./spec/requests/producer_pages_spec.rb:14:in `block (3 levels) in <top (required)>'
プロデューサー インスタンス変数の作成に問題があるようです。それを通常の変数にしようとしましたが、次のエラーが発生します。
  1) ProducerPages profile page
     Failure/Error: before { visit producer_path(producer) }
     ActionController::RoutingError:
       No route matches {:action=>"show", :controller=>"producers", 
     :id=>#<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>}
     # ./spec/requests/producer_pages_spec.rb:14:in `block (3 levels) in <top (required)>'
routes.rb ファイルには含まれています
  resources :producers
私は何を間違っていますか?