title: Rspec error NameError: uninitialized constant on a Factory
body: <p>I am creating a set of tests with two factories, see below:</p>
  
  <p>spec/factories/page.rb</p>
  
  <pre><code>FactoryGirl.define do 
      factory :page do
        title "Example Title"
        content "Here is some sample content"
        published_on "2013-06-02 02:28:12"
      end 
      factory :page_invalid do
        title ""
        content ""
        published_on "2013-06-02 02:28:12"
      end 
  end
  </code></pre>
  
  <p>However, in spec/controllers/page_controller_spec.rb, the following test throws an error:</p>
  
  <pre><code>describe "with invalid params" do 
    it "does not save the new page in the database" do
      expect {
        post :create, {page: attributes_for(:page_invalid)}, valid_session
        }.to_not change(Page, :count).by(1)
    end
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>  1) Api::PagesController POST create with invalid params does not save the new page in the database
       Failure/Error: post :create, {page: attributes_for(:page_invalid)}, valid_session
       NameError:
         uninitialized constant PageInvalid
       # ./spec/controllers/pages_controller_spec.rb:78:in `block (5 levels) in &lt;top (required)&gt;'
       # ./spec/controllers/pages_controller_spec.rb:77:in `block (4 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>This code is analogous to code in Everyday Rails Rspec so I'm not sure why the page_invalid factory isn't being recognized.</p>