Sha256: da2c8a127e13abdd6387d10dd23a9ea94a266a7f5890a77882aba87f31791176
Contents?: true
Size: 456 Bytes
Versions: 22
Compression:
Stored size: 456 Bytes
Contents
module UserFactory def create_user role = :user # ||= here is important! @user ||= user_class(role).create(:name => "Kristian") end def create_user_account user, role = :user user.active_account = account_class(role).create :role => role, :user => user user.active_account end def user_class role "#{role.to_s.camelize}".constantize end def account_class role "#{role.to_s.camelize}Account".constantize end end
Version data entries
22 entries across 22 versions & 1 rubygems