title: nested resource not working testing view rspec
body: <p>i have some problem with nested resource in spec view rspec,</p>
  
  <p>i have route like this :</p>
  
  <pre><code>resources :customers do
    resources :charges
  end
  </code></pre>
  
  <p>and this my view testing using rspec :</p>
  
  <pre><code>require 'rails_helper'
  
  RSpec.describe "charges/index", :type =&gt; :view do
    before(:each) do
      assign(:customers, [
        @customer1 = Customer.create!(
          :first_name =&gt; "tardjo",
          :last_name =&gt; "ea...ea...ea"
        ),
        @customer2 = Customer.create!(
          :first_name =&gt; "udin",
          :last_name =&gt; "penyok"
        )
      ])
  
      assign(:charges, [
        Charge.create!(
          :created =&gt; 1,
          :paid =&gt; false,
          :amount =&gt; 1.5,
          :currency =&gt; "Currency",
          :refunded =&gt; false,
          :disputed =&gt; false,
          :customer_id =&gt; @customer1.id
        ),
        Charge.create!(
          :created =&gt; 1,
          :paid =&gt; false,
          :amount =&gt; 1.5,
          :currency =&gt; "Currency",
          :refunded =&gt; false,
          :disputed =&gt; false,
          :customer_id =&gt; @customer2.id
        )
      ])
    end
  
    it "renders a list of charges" do
      render
      assert_select "tr&gt;td", :text =&gt; 1.to_s, :count =&gt; 2
      assert_select "tr&gt;td", :text =&gt; false.to_s, :count =&gt; 2
      assert_select "tr&gt;td", :text =&gt; 1.5.to_s, :count =&gt; 2
      assert_select "tr&gt;td", :text =&gt; "Currency".to_s, :count =&gt; 2
      assert_select "tr&gt;td", :text =&gt; false.to_s, :count =&gt; 2
      assert_select "tr&gt;td", :text =&gt; 2.to_s, :count =&gt; 2
      assert_select "tr&gt;td", :text =&gt; false.to_s, :count =&gt; 2
    end
  end
  </code></pre>
  
  <p>but i get error like this :</p>
  
  <p>Failure/Error: render</p>
  
  <p>ActionView::Template::Error:
     No route matches {:customer_id=>nil, :id=>1} missing required keys: [:customer_id]</p>
  
  <p>stuck in here</p>