views:

50

answers:

0

I'm having trouble runnng rspec2 and rails. Here's my log:

1) TrackController home path should be /track
    Failure/Error: Unable to find C to read failed line
    undefined method `route_for' for #<#<Class:01x5ffe7c2f>:0x77d36efb>
    # ./spec/controllers/track_controller_spec.rb:5
    # :1

Here's my spec:

describe UsersController, :type => :controller do

  describe "registering a new user" do
    #mock new
    before(:each) do
      User.stub!(:new).and_return(@user = mock_model(User, :save=>true))
    end
    #utility method to create a user
    def do_create
      post :create, :user=>{:email=>"[email protected]", :password =>'password'}
    end

    it "should create the User" do
      User.should_receive(:new).with("email"=>"[email protected]", "password" =>'password').and_return(@user)
      do_create
    end
end

My spec is under /spec/controllers. Am I doing something wrong? Besides, I don't have the rake task for checking code coverage (ie, spec:rcov doesn't work). I'm using rails3 beta4 and rspec2 beta15