kurenn / market_place_api

The API on Rails tutorial application
142 stars 68 forks source link

`@user.save` in Listing 6.5 gives an error. Fixed. #58

Open SpacyRicochet opened 8 years ago

SpacyRicochet commented 8 years ago

The line @user.save in Listing 6.5 gives the following error:

Failures:

  1) Api::V1::UsersController#products association do destroys the associated products on self destruct
     Failure/Error: @user.save
     NoMethodError:
       undefined method `save' for nil:NilClass
     # ./spec/controllers/api/v1/users_controller_spec.rb:103:in `block (3 levels) in <top (required)>'

The actual line should be:

@user = FactoryGirl.create :user

which agrees with the previous contexts as well. The tests succeed at this point.