market_place_api icon indicating copy to clipboard operation
market_place_api copied to clipboard

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

Open SpacyRicochet opened this issue 9 years ago • 0 comments

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.

SpacyRicochet avatar Jan 11 '16 15:01 SpacyRicochet