Browse files

Remove tags, duplicate posts, invoices and date entries from models

We are no longer testing these, because if we were, we would be testing
AR functionality, and that's boring
  • Loading branch information...
1 parent 7eeca50 commit fc345de292e20524fb8cb1aa8b4c11744997f80e @radar committed Feb 19, 2012
Showing with 3 additions and 51 deletions.
  1. +3 −51 spec/fixtures/models.rb
View
54 spec/fixtures/models.rb
@@ -7,26 +7,11 @@ def self.factory(text, created_at = nil)
end
end
-class Tag < ActiveRecord::Base
- has_and_belongs_to_many :posts
-end
-
class Event < ActiveRecord::Base
by_star_field :start_time
scope :secret, :conditions => { :public => false }
end
-class Invoice < ActiveRecord::Base
- has_many :day_entries
- def self.factory(value, created_at = nil)
- create!(:value => value, :created_at => created_at, :number => value)
- end
-end
-
-class DayEntry < ActiveRecord::Base
-
-end
-
## seed data:
year = Time.zone.now.year
@@ -35,19 +20,6 @@ class DayEntry < ActiveRecord::Base
Post.factory "post #{month}", Time.zone.now.beginning_of_year + (month - 1).months
end
-1.upto(12) do |month|
- Invoice.factory 10000, Time.zone.now.beginning_of_year + (month - 1).months
-end
-
-# Inovice for 2nd January for sum_by_day
-Invoice.factory 5500, Time.zone.now.beginning_of_year + 1.day
-
-# Invoice from last year
-Invoice.factory 10000, Time.local(Time.zone.now.year-1, 1, 1)
-
-# Invoice without a number for count_by_year test
-Invoice.create!(:value => 10000, :number => nil)
-
Post.factory "Today's post", Time.zone.now
Post.factory "Yesterday's post", Time.zone.now - 1.day
Post.factory "Tomorrow's post", Time.zone.now + 1.day
@@ -61,31 +33,11 @@ class DayEntry < ActiveRecord::Base
# For by_weekend scoped test
post = Post.factory "Weekend", weekend_time
-post.tags.create(:name => "weekend")
-
-# For by_day scoped test
-post = Post.factory "Today", Time.zone.now
-post.tags.create(:name => "today")
-
-# For yesterday scoped test
-post = Post.factory "Yesterday", Time.zone.now.yesterday
-post.tags.create(:name => "yesterday")
-
-# 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.zone.now.beginning_of_year - 1.year
-post.tags.create(:name => "ruby")
-
-post = Post.factory "End of last year", Time.zone.now.end_of_year - 1.year
-post.tags.create(:name => "final")
-post = Post.factory "The 'Current' Fortnight", Time.zone.now
-post.tags.create(:name => "fortnight")
+# Offset by two seconds to stop it clashing with "Today's post" in next test
+post = Post.factory "The 'Current' Fortnight", Time.zone.now + 2.seconds
-post = Post.factory "The 'Current' Week", Time.zone.now
-post.tags.create(:name => "week")
+post = Post.factory "The 'Current' Week", Time.zone.now + 2.seconds
Event.create(:name => "Ryan's birthday!", :start_time => "04-12-#{Time.zone.now.year}".to_time)

0 comments on commit fc345de

Please sign in to comment.