metamaps--metamaps/spec/factories/users.rb
Devin Howard 7d4da81272 Update code style automatically using rubocop gem (#563)
* install rubocop

* 1961 automatic rubocop fixes

* update rubocop.yml to ignore half of the remaining cops

* rubocop lint warnings

* random other warnings fixed
2016-07-26 08:14:23 +08:00

30 lines
880 B
Ruby

#
# This file supports three factories, because code and joinedwithcode
# make things complicated!
#
# Generally, use :simple_user to generate users. It's simplest.
#
# If you want to test code generation, or need a setup with users that
# have actual codes, you'll need to specify one simple_user and then you
# can specify other :code_user users based on the pre-existing user's code.
FactoryGirl.define do
factory :code_user, class: User do
sequence(:name) { |n| "Cool User ##{n}" }
sequence(:email) { |n| "cooluser#{n}@cooldomain.com" }
password 'omgwtfbbq'
factory :simple_user, aliases: [:user] do
joinedwithcode { 'qwertyui' }
code { 'qwertyui' }
transient do
validate false
end
# bypass validation of the joinedwithcode
to_create { |instance| instance.save(validate: instance.validate) }
end
end
end