title: RSpec + Factory_Girl View Testing
body: <p>Again, seem to be stuck on a simple view test. Here's the code:</p>
  
  <pre><code>require 'spec_helper'
  
  describe "posts/show.html.erb" do
    setup do
      @post = Factory(:post)
    end
  
    it "should not render a canonical link rel" do
      get :show, :id =&gt; @post.id
      response.should_not have_tag("link[rel=?]", "canonical")
    end
  end
  </code></pre>
  
  <p>When I do Factory(:post) from the console, no problems, creates it perfectly. But when I run this on the command line, I get the following:</p>
  
  <pre><code>rspec spec/views/posts/show.html.erb_spec.rb 
  F
  
  Failures:
  
    1) posts/show.html.erb should not render a canonical link rel
       Failure/Error: get :show, :id =&gt; @post.id
       RuntimeError:
         Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
       # ./spec/views/posts/show.html.erb_spec.rb:11
  
  Finished in 0.06532 seconds
  1 example, 1 failure
  </code></pre>
  
  <p>Any ideas what I'm missing?</p>