Skip to content

Commit

Permalink
cleaning up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
GBH committed May 10, 2018
1 parent e5c62eb commit 2a623a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
1 change: 0 additions & 1 deletion app/controllers/comfy/blog/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def index
end

scope = scope.for_category(params[:category]) if params[:category]

scope = scope.order(:published_at).reverse_order

@blog_posts = comfy_paginate(scope, per_page: ComfyBlog.config.posts_per_page)
Expand Down
15 changes: 4 additions & 11 deletions test/controllers/comfy/blog/posts_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,17 @@ def test_get_index_with_category_invalid

def test_get_index_is_sorted
new_post = @site.blog_posts.create!(
site: comfy_cms_sites(:default),
title: "Default title 2",
slug: "default-title-2",
is_published: true,
year: 2012,
month: 1,
published_at: DateTime.new(2012, 1, 1, 1, 24, 0),
layout: comfy_cms_layouts(:default)
title: "Test Post",
published_at: @post.published_at + 1.day,
layout: comfy_cms_layouts(:default)
)

get comfy_blog_posts_path

assert_response :success
assert assigns(:blog_posts)
assert_equal 2, assigns(:blog_posts).count

assert_equal new_post, assigns(:blog_posts)[0]
assert_equal comfy_blog_posts(:default), assigns(:blog_posts)[1]
assert_equal [new_post, @post], assigns(:blog_posts).to_a
end

def test_get_show
Expand Down

0 comments on commit 2a623a3

Please sign in to comment.