Sha256: 7776e047ca09658358cc025b640b06b289d5a62931b1ed6199b0d57db61e2bf7

Contents?: true

Size: 673 Bytes

Versions: 10

Compression:

Stored size: 673 Bytes

Contents

class MockName < String
  def name; to_s end
  
  def self.mock!(name)
    ActiveModel::Name.new(MockName.new(name))
  end
end

def fill_db(options={})
  options = { :fill => true, :genders => false }.merge(options)

  if options[:fill]
    # fill db with some rows
    Dummy.create({ :name => 'Anna',  :gender_cd => 1, :word_cd => 'alpha', :other => 0})
    Dummy.create({ :name => 'Bella', :gender_cd => 1, :word_cd => 'beta', :other => 1})
    Dummy.create({ :name => 'Chris', :gender_cd => 0, :word_cd => 'gamma', :other => 2})
  end

  if options[:genders]
    @male   = Gender.create!({ :name => 'male' })
    @female = Gender.create!({ :name => 'female' })
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
simple_enum-1.6.9 test/orm/common.rb
simple_enum-1.6.8 test/orm/common.rb
simple_enum-1.6.7 test/orm/common.rb
simple_enum-1.6.5 test/orm/common.rb
simple_enum-1.6.4 test/orm/common.rb
simple_enum-1.6.3 test/orm/common.rb
simple_enum-1.6.2 test/orm/common.rb
simple_enum-1.6.1 test/orm/common.rb
simple_enum-1.5.1 test/orm/common.rb
simple_enum-1.5.0 test/orm/common.rb