Another option is to do something like
user = User.new.tap do |u| u.email = ' email@server.com ' u.password = 'hackme!' u.password_confirmation = 'hackme!' u.skip_confirmation! u.save! end
So you create an instance of the object, skip the confirmation and save it in one step and return it to the user variable.
This is just another way to do the same in one step.
source share