Sha256: 397af031be102738ba29dba6729ad40d2c050115f0d4aeba317278dcfcbd1d12

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

class Player
  include DataMapper::Resource

  property :id, Serial
  property :created_at, DateTime
  property :updated_at, DateTime
  property :deleted_at, ParanoidDateTime
  property :team_id, Integer, :nullable => false, :index => true
  property :number, Integer, :nullable => false
  property :name, String, :length => 100, :nullable => false
  property :position, Enum[:pitcher, :catcher, :first, :second, :third, :shortstop, :left, :center, :right]
  property :sex, Enum[:male, :female]
  property :batting_average, Float, :default => 0.0, :precision => 4, :scale => 3
  property :injured, Boolean, :default => false
  property :retired, TrueClass, :default => false
  property :born_on, Date
  property :wake_at, Time
  property :notes, Text

  belongs_to :team
end

Player.fixture {{
  :team_id => /\d{1,2}/.gen,
  :number => /\d{1,2}/.gen,
  :name => "#{/\w{3,10}/.gen.capitalize} #{/\w{5,10}/.gen.capitalize}",
  :position => Player.properties[:position].type.flag_map.values[rand(Player.properties[:position].type.flag_map.length)],
  :sex => Player.properties[:sex].type.flag_map.values[rand(Player.properties[:sex].type.flag_map.length)],
}}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sferik-merb-admin-0.2.8 spec/fixtures/player_fixture.rb
sferik-merb-admin-0.3.0 spec/fixtures/player_fixture.rb
sferik-merb-admin-0.3.1 spec/fixtures/player_fixture.rb