Files
railsgoat/spec/support/user_fixture.rb
T
chrismo 73e8ab972b assign_user_id and UserFixture password fixes.
When the database is empty, which can happen in the test database and in
the dev database if the seeds.rb aren't applied, the assign_user_id
method would not assign an id and the newer before_filter block to
generate_token would fail.

UserFixture had a password on it that wouldn't pass the new validation
rules once that vulnerability is patched.
2015-01-06 13:21:45 -05:00

19 lines
460 B
Ruby

class UserFixture
def self.reset_all_users
User.delete_all
Rails.application.load_seed
end
def self.normal_user
password = 'thi$ 1s cOmplExEr'
user = User.new(:first_name => 'Joe', :last_name => 'Schmoe',
:email => 'joe@schmoe.com', :password => password, :password_confirmation => password)
def user.clear_password
'thi$ 1s cOmplExEr'
end
user.build_benefits_data
user.save!
user
end
end