my gem file looks like

```
source 'http://rubygems.org'
gem 'rails', '3.1.0.rc6'
gem 'sqlite3'
gem 'devise'
gem 'will_paginate'
gem 'therubyracer'
group :assets do
  gem 'sass-rails', "  ~> 3.1.0.rc"
  gem 'coffee-rails', "~> 3.1.0.rc"
  gem 'uglifier'
end
gem 'jquery-rails'

group :test do
  gem 'turn', :require => false
  gem 'rspec-rails'
  gem 'webrat'
end

group :development do
gem 'rspec-rails'
gem 'webrat'
gem 'spork'
gem 'factory_girl_rails'
gem 'capybara'
gem 'guard-rspec'
end

```

my factories.rb

```
Factory.define :user do |user|
  user.username              "ccc"
  user.email                 "ccc@eg.com"
  user.password              "foobar"
  user.password_confirmation "foobar"
end

Factory.define :user_hero do |hero|  
  hero.supername        "superman"
  hero.association :user
end

```

my hero\_controller\_spec looks like this

```
require 'spec_helper'

describe HerosController do
  include Devise::TestHelpers
  render_views

  before(:each) do
    @user       = Factory(:user)
    # @request.env["devise.mapping"] = :user
    # @user = Factory.create(:user)
    sign_in @user
    @hero_attr   = {
      :supername        => "superman",
    }
  end

  it "should create a new instance with valid attributes" do
    @user.heros.create!(@hero_attr)
  end

end

```

My autotest or guard shows up the following message

```
Failures:

  1) HerosController should create a new instance with valid attributes
     Failure/Error: @user       = Factory(:user)
     NoMethodError:
       undefined method `Factory' for #<RSpec::Core::ExampleGroup::Nested_1:0x000001028a3998>
     # ./spec/controllers/heros_controller_spec.rb:8:in `block (2 levels) in <top (required)>'

Finished in 0.00726 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/controllers/heros_controller_spec.rb:33 # HerosController should create a new instance with valid attributes

```