Fix last_comment_at issue (#94)

* Fix last_comment_at issue

* Fix classic article test
This commit is contained in:
Ben Halpern 2018-03-17 14:40:56 -04:00 committed by GitHub
parent 993002506f
commit 6938f3b78e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 8 deletions

View file

@ -402,7 +402,7 @@ class Article < ApplicationRecord
end
def set_last_comment_at
self.last_comment_at = published_at.present? if published_at.present? && last_comment_at.blank?
self.last_comment_at = published_at if published_at.present? && last_comment_at.blank?
end
def title_to_slug

View file

@ -19,13 +19,6 @@ RSpec.describe ClassicArticle do
expect(described_class.new(user).get).to eq nil
end
it "does not return article if user does not follow" do
create(:reaction, user_id: user.id, reactable_id: article.id)
create(:reaction, user_id: user.id, reactable_id: article.id, category:"thinking")
create(:reaction, user_id: user.id, reactable_id: article.id, category:"unicorn")
expect(described_class.new(user).get).to eq nil
end
it "returns single article if multiple qualify" do
user.follow(tag)
create(:reaction, user_id: user.id, reactable_id: article.id)