spec/fixtures/models.rb in by_star-0.5.2 vs spec/fixtures/models.rb in by_star-0.6.0
- old
+ new
@@ -53,11 +53,17 @@
Post.factory "Tomorrow's post", Time.zone.now + 1.day
Post.factory "That's it!", Time.zone.now.end_of_year
# For by_weekend scoped test
-post = Post.factory "Weekend of May", "16-05-#{Time.zone.now.year}".to_time
+# We need to calculate the weekend.
+time = Time.now.beginning_of_year
+while time.wday != 6
+ time += 1.day
+end
+
+post = Post.factory "Weekend of January", time
post.tags.create(:name => "weekend")
# For by_day scoped test
post = Post.factory "Today", Time.zone.now
post.tags.create(:name => "today")
@@ -68,20 +74,21 @@
# For tomorrow scoped test
post = Post.factory "Tomorrow's Another Day", Time.zone.now.tomorrow
post.tags.create(:name => "tomorrow")
-post = Post.factory "Last year", Time.local(year - 1, 1, 1)
+post = Post.factory "Last year", Time.zone.now.beginning_of_year - 1.year
post.tags.create(:name => "ruby")
-post = Post.factory "The 'Current' Fortnight", Time.local(year, 5, 15)
+post = Post.factory "The 'Current' Fortnight", Time.zone.now.beginning_of_year
post.tags.create(:name => "may")
-post = Post.factory "The 'Current' Week", Time.local(year, 5, 15)
+post = Post.factory "The 'Current' Week", Time.zone.now.beginning_of_year
post.tags.create(:name => "may2")
Event.create(:name => "Ryan's birthday!", :start_time => "04-12-#{Time.zone.now.year}".to_time)
+Event.create(:name => "Ryan's birthday, last year!", :start_time => "04-12-#{Time.zone.now.year-1}".to_time)
Event.create(:name => "Dad's birthday!", :start_time => "05-07-#{Time.zone.now.year}".to_time)
Event.create(:name => "Mum's birthday!", :start_time => "17-11-#{Time.zone.now.year}".to_time)
Event.create(:name => "Today", :start_time => Time.zone.now)
Event.create(:name => "Yesterday", :start_time => Time.zone.now.yesterday)
Event.create(:name => "Tomorrow", :start_time => Time.zone.now.tomorrow)
\ No newline at end of file