spec/fixtures/models.rb in by_star-0.6.0 vs spec/fixtures/models.rb in by_star-0.6.1
- old
+ new
@@ -10,11 +10,11 @@
class Tag < ActiveRecord::Base
has_and_belongs_to_many :posts
end
class Event < ActiveRecord::Base
- named_scope :private, :conditions => { :public => false }
+ named_scope :secret, :conditions => { :public => false }
end
class Invoice < ActiveRecord::Base
has_many :day_entries
def self.factory(value, created_at = nil)
@@ -26,26 +26,28 @@
end
## seed data:
+[Post, Event, Invoice, Tag, DayEntry].map(&:delete_all)
+
year = Time.zone.now.year
1.upto(12) do |month|
month.times do |n|
- Post.factory "post #{n}", Time.local(year, month, 1)
+ Post.factory "post #{month}-#{n}", Time.zone.now.beginning_of_year + (month - 1).months
end
end
1.upto(12) do |month|
month.times do |n|
- Invoice.factory n * 1000 + 1000, Time.local(year, month, 1)
+ Invoice.factory n * 1000 + 1000, Time.zone.now.beginning_of_year + (month - 1).months
end
end
# Invoice from last year
-Invoice.factory 10000, Time.local(Time.now.year-1, 1, 1)
+Invoice.factory 10000, Time.local(Time.zone.now.year-1, 1, 1)
# Invoice without a number
Invoice.create!(:value => 10000, :number => nil)
Post.factory "Today's post", Time.zone.now
@@ -54,10 +56,10 @@
Post.factory "That's it!", Time.zone.now.end_of_year
# For by_weekend scoped test
# We need to calculate the weekend.
-time = Time.now.beginning_of_year
+time = Time.zone.now.beginning_of_year
while time.wday != 6
time += 1.day
end
post = Post.factory "Weekend of January", time
\ No newline at end of file