1
votes

I'm simply trying to test my user model.

The error comes from testing this bit.

describe User do
  before do 
    @user = User.new(email: "[email protected]", password:"foobar",
                 password_confirmation:"foobar", goal:"cut")
  end

  subject( @user )    
  .
  .
  .

Here is the exact error:

rspec-core-2.10.1/lib/rspec/core/subject.rb:180:in `subject': wrong number of arguments (1 for 0) (ArgumentError)

Thanks for the help!

1

1 Answers

4
votes

In rspec 2.10.1, subject() does not allow for any arguments. See http://rubydoc.info/gems/rspec-core/2.10.1/RSpec/Core/Subject/ExampleGroupMethods#subject-instance_method

I believe you actually want to pass @user as a block, so:

subject{ @user }

Notice the {} instead of ().