I have an ActiveRecord object User. In the app I am making I am using a single sign on gem, but I need to save some of the user data in our databse. My ApplicationController has this code:
def create_user
User.create(name: current_user['name'], email: current_user['email'], company_id: current_user['id'])
end
I need an RSpec test that mocks out the actual create
call. I have tried
allow_any_instance_of(User).to receive(:create).with(any_args).and_return(user)
which returns an error saying "User does not implement create".