title: How do I test a local variable inside a controller with Rspec?
body: <p>In my <code>Dashboard#Index</code>, I have this:</p>
  
  <pre><code>  def index        
      tagged_nodes = Node.includes(:user_tags).tagged_with(current_user.email)    
    end
  </code></pre>
  
  <p>How do I test this with RSpec? </p>
  
  <p>I tried:</p>
  
  <pre><code>  expect(assigns(tagged_nodes)).to match Node.includes(:user_tags).tagged_with(u1.email)
  </code></pre>
  
  <p>But that gives me this error:</p>
  
  <pre><code> NameError:
         undefined local variable or method `tagged_nodes' for #&lt;RSpec::ExampleGroups::DashboardController::GETIndex:0x007fe4edd7f058&gt;
  </code></pre>