title: Rails Fixtures not loading with rspec
body: <p>So, I'm trying to learn the rspec BDD testing framework in the context of a rails project.  The problem I'm having is that I can't, for the life of me, get my fixtures to load properly in rspec descriptions.</p>
  
  <p>Disclaimer: Yes, there are better things than fixtures to use.  I'm trying to learn one thing at a time, here (specifically rspec) before I go play with associated tools like factory-girl, mocha, auto-test, etc.  As such, I'm trying to get the dead-simple, if clunky, fixtures working.</p>
  
  <p>Anyway, here's the code:</p>
  
  <p>/test/fixtures/users.yml - </p>
  
  <pre><code># password: "secret"
  foo:
    username: foo
    email: foo@example.com
    password_hash: 3488f5f7efecab14b91eb96169e5e1ee518a569f
    password_salt: bef65e058905c379436d80d1a32e7374b139e7b0
  
  bar:
    username: bar
    email: bar@example.com
    password_hash: 3488f5f7efecab14b91eb96169e5e1ee518a569f
    password_salt: bef65e058905c379436d80d1a32e7374b139e7b0
  </code></pre>
  
  <p>/spec/controllers/pages_controller_spec.rb - </p>
  
  <pre><code>require 'spec/spec_helper'
  
  describe PagesController do
    integrate_views
    fixtures :users
    it "should render index template on index call when logged in" do
      session[:user_id] = user(:foo).id
      get 'index' 
      response.should render_template('index')
    end
  end
  </code></pre>
  
  <p>And what I'm getting when I run 'rake spec' is:</p>
  
  <pre><code>NoMethodError in 'PagesController should render index template on index call when logged in'
  undefined method `user' for #&lt;Spec::Rails::Example::ControllerExampleGroup::Subclass_1:0x2405a7c&gt;
  /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/test_process.rb:511:in `method_missing'
  ./spec/controllers/pages_controller_spec.rb:7:
  </code></pre>
  
  <p>That is, it's not recognizing 'user(:foo)' as a valid method.</p>
  
  <p>The fixtures themselves must be ok, since when I load them into the development db via 'rake db:fixtures:load', I can verify that foo and bar are present in that db.</p>
  
  <p>I feel like I'm missing something obvious here, but I've been tearing my hair out all day to no avail.  Any help would be appreciated.</p>