Skip to content

Commit

Permalink
Add published at to order article
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick Francois committed Sep 15, 2013
1 parent 498030b commit c13ebcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/user.rb
Expand Up @@ -16,7 +16,7 @@ class User < ActiveRecord::Base
:source => 'notify_content',
:uniq => true

has_many :articles, :order => 'created_at DESC'
has_many :articles

serialize :settings, Hash

Expand Down
5 changes: 3 additions & 2 deletions spec/controllers/authors_controller_spec.rb
Expand Up @@ -2,11 +2,12 @@

describe AuthorsController do
let!(:blog) { create(:blog, limit_article_display: 1) }
let(:now) { DateTime.new(2012,12,23,3,45) }

describe :show do
describe "With an empty profile" do
let(:no_profile_user) { create(:user_with_an_empty_profile) }
let!(:article) { create(:article, user: no_profile_user) }
let!(:article) { create(:article, user: no_profile_user, published_at: now - 1.hour) }

describe "html" do
before(:each) { get 'show', id: no_profile_user.login }
Expand All @@ -27,7 +28,7 @@
end

describe "with pagination" do
let!(:article_page_2) { create(:article, user: no_profile_user) }
let!(:article_page_2) { create(:article, user: no_profile_user, published_at: now - 1.day) }
before(:each) { get 'show', id: no_profile_user.login, page: 2 }
it { expect(assigns(:articles)).to eq([article_page_2]) }
end
Expand Down

0 comments on commit c13ebcd

Please sign in to comment.