diff --git a/app/models/topic.rb b/app/models/topic.rb index ba0ddbb..be52570 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -48,7 +48,7 @@ class Topic < ActiveRecord::Base acts_as_readable def self.recent_topics - Post.order('id desc').select('DISTINCT topic_id').limit(5).map(&:topic) + Post.order("id desc").select("DISTINCT topic_id").limit(5).map(&:topic) end def to_s diff --git a/spec/factories/forum.rb b/spec/factories/forum.rb index 3ad7213..a5bbe09 100644 --- a/spec/factories/forum.rb +++ b/spec/factories/forum.rb @@ -3,4 +3,4 @@ FactoryGirl.define do sequence(:title) { |n| "Forum Title #{n}" } sequence(:description) { |n| "Forum Description #{n}" } end -end \ No newline at end of file +end diff --git a/spec/factories/post.rb b/spec/factories/post.rb index ec0de0b..e557bbb 100644 --- a/spec/factories/post.rb +++ b/spec/factories/post.rb @@ -4,4 +4,4 @@ FactoryGirl.define do topic user end -end \ No newline at end of file +end diff --git a/spec/factories/topic.rb b/spec/factories/topic.rb index 1eb1820..39637c0 100644 --- a/spec/factories/topic.rb +++ b/spec/factories/topic.rb @@ -4,7 +4,7 @@ FactoryGirl.define do forum user before(:create) do |topic| - topic.first_post = "My first post on the topic" + topic.first_post = "My first post on the topic" end end -end \ No newline at end of file +end diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index 536c50b..836e9cb 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -32,9 +32,7 @@ describe Topic do before(:all) do 5.times do topic = create :topic - 3.times do - post = create :post, topic: topic - end + 3.times { create :post, topic: topic } end end it "returns 5 unique, most recently posted topics" do