Module: Memory::UserFactory

Defined in:
lib/artisan-memory-repository/factories/user_factory.rb

Class Method Summary collapse

Class Method Details

.build(opts = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/artisan-memory-repository/factories/user_factory.rb', line 6

def self.build(opts = {})
  ArtisanMemoryRepository::User.new(
    :full_name => opts[:full_name] || "Test User",
    :projects => opts[:projects] || [],
    :members => opts[:members] || [],
    :login => opts[:login] || "test",
    :email => opts[:email] || "[email protected]",
    :gravatar_url => opts[:gravatar_url] || "",
    :password => opts[:password] || "password",
    :password_confirmation => opts[:password_confirmation] || "password")
end

.create(opts = {}) ⇒ Object



18
19
20
21
22
# File 'lib/artisan-memory-repository/factories/user_factory.rb', line 18

def self.create(opts = {})
  record = Memory::UserFactory.build(opts)
  Artisan::Repository.user.save(record)
  record
end