title: railstutorial.org - undefined method `Factory'
body: <p>I'm attempting to follow railstutorial.org, and am currently on Chapter 7, where you start using factories: <a href="http://railstutorial.org/chapters/modeling-and-viewing-users-two#sec:tests_with_factories" rel="nofollow noreferrer">http://railstutorial.org/chapters/modeling-and-viewing-users-two#sec:tests_with_factories</a></p>
  
  <p>I'm using Rails 3.0.1 and ruby-1.9.2-p0</p>
  
  <p>I can't for the life of me get my rspec tests to pass though, the error i get is </p>
  
  <pre><code>Failures:
      1) UsersController GET 'show' should be successful
       Failure/Error: @user = Factory(:user)
       undefined method `Factory' for #&lt;RSpec::Core::ExampleGroup::Nested_2::Nested_1:0x00000101cc5608&gt;
   # ./spec/controllers/users_controller_spec.rb:9:in `block (3 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>my factories.rb looks like this:</p>
  
  <pre><code># By using the symbol ':user', we get Factory Girl to simulate the User model.
  Factory.define :user do |user|
    user.name                  "Michael Hartl"
    user.email                 "mhartl@example.com"
    user.password              "foobar"
    user.password_confirmation "foobar"
  end
  </code></pre>
  
  <p>and this is my <code>users_controller_spec.rb</code> file:</p>
  
  <pre><code>require 'spec_helper'
  
  describe UsersController do
    render_views
  
    describe "GET 'show'" do
      before(:each) do
        @user = Factory(:user)
      end
      it "should be successful" do
        get :show, :id =&gt; @user
        response.should be_success
      end
  </code></pre>
  
  <p>here is my Gemfile, if it helps:</p>
  
  <pre><code>source 'http://rubygems.org'
  
  gem 'rails', '3.0.1'
  
  # Bundle edge Rails instead:
  # gem 'rails', :git =&gt; 'git://github.com/rails/rails.git'
  
  gem 'sqlite3-ruby', :require =&gt; 'sqlite3'
  gem 'gravatar_image_tag'
  
  group :development do
    gem 'rspec-rails'
    gem 'annotate-models'
  end
  
  group :test do
    gem 'rspec'
    gem 'webrat'
    gem 'spork'
    gem 'factory_girl_rails'
  end
  </code></pre>