Skip to content

Instantly share code, notes, and snippets.

@jferris
Created September 8, 2010 19:03
Show Gist options
  • Select an option

  • Save jferris/570638 to your computer and use it in GitHub Desktop.

Select an option

Save jferris/570638 to your computer and use it in GitHub Desktop.
describe Topic, "newest ordered by creation" do
factory :first_topic, :topic, :created_at => 3.days.ago
factory :second_topic, :topic, :created_at => 2.days.ago
factory :third_topic, :topic, :created_at => 1.day.ago
factory :fourth_topic, :topic, :created_at => 1.day.ago
it "should be able to find the newest topics" do
Topic.newest.map.should == [fourth_topic,
third_topic,
second_topic,
first_topic]
end
end
describe Topic, "newest ordered by creation" do
before do
@first_topic = Factory(:topic, :created_at => 3.days.ago)
@second_topic = Factory(:topic, :created_at => 2.days.ago)
@third_topic = Factory(:topic, :created_at => 1.day.ago)
@fourth_topic = Factory(:topic, :created_at => 1.day.ago)
end
it "should be able to find the newest topics" do
Topic.newest.map.should == [@fourth_topic,
@third_topic,
@second_topic,
@first_topic]
end
end
describe Topic do
factory :project
factory :account, :name => "My Account"
factory(:user) { Factory(:user, :account => account) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment