Sha256: 0792c1e1f45db57d109e8ad05e4e2eb6a184d6bb3bc1a73a4ef1b1b1ef93df72

Contents?: true

Size: 920 Bytes

Versions: 4

Compression:

Stored size: 920 Bytes

Contents

Factory.define :time_table_date, :class => "Chouette::TimeTableDate" do |tmd|
end
Factory.define :time_table_period, :class => "Chouette::TimeTablePeriod" do |tmp|
end

Factory.define :time_table, :class => "Chouette::TimeTable" do |time_table|
  time_table.sequence(:comment) { |n| "Timetable #{n}" }
  time_table.sequence(:objectid) { |n| "test:Timetable:#{n}" }
  time_table.sequence(:int_day_types) { (1..7).to_a.map{ |n| 2**(n+1)}.sum }
  time_table.after_create { |t|
    0.upto(4) do |i|
      t.dates.create(Factory.attributes_for(:time_table_date, :date => i.days.since.to_date, :in_out => true))
    end
    start_date = Date.today
    end_date = start_date + 10
    0.upto(3) do |i|
      t.periods.create(Factory.attributes_for(:time_table_period, :period_start => start_date, :period_end => end_date))
      start_date = start_date + 20
      end_date = start_date + 10
    end
    t.save_shortcuts
  }
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ninoxe-1.1.5 lib/factories/chouette_time_table.rb
ninoxe-1.1.4 lib/factories/chouette_time_table.rb
ninoxe-1.1.3 lib/factories/chouette_time_table.rb
ninoxe-1.1.2 lib/factories/chouette_time_table.rb