I’m running into this error while trying to run a unit test on a
Mongoid database:
def show
id=params[:id]
@user=User.find(:first,id)
end
My test
before(:each) do
@user = Fabricate(:user)
sign_in @user
end
…
it “should be successful” do
get “show”, :id => @user
response.should be_success
end
And the error message
- UsersController GET ‘show’ for the logged in user should be
successful
Failure/Error: get “show”, :id => @user
TypeError:
can’t convert Symbol into Integer./app/controllers/users_controller.rb:6:in `show’
./spec/controllers/users_controller_spec.rb:31:in `block (4
levels) in <top (required)>’
Does anyone know why this keeps happening and what I can do to fix
it?