Skip to content
Permalink
Browse files

Fix RuboCop Performance offenses in test files (#7839)

* Replace select.first with find
* Replace select.count with count
  • Loading branch information...
udayan28 authored and ashmaroli committed Oct 6, 2019
1 parent de6548f commit 3eab32fad732994057e1d6deee91ba797c8ea4c2
Showing with 2 additions and 2 deletions.
  1. +1 −1 test/test_document.rb
  2. +1 −1 test/test_filters.rb
@@ -175,7 +175,7 @@ def setup_document_with_dates(filename)
}]
)
@site.process
@document = @site.collections["slides"].docs.select { |d| d.is_a?(Document) }.first
@document = @site.collections["slides"].docs.find { |d| d.is_a?(Document) }
end

should "know the front matter defaults" do
@@ -1036,7 +1036,7 @@ def to_liquid
posts = @filter.site.site_payload["site"]["posts"]
results = @filter.where_exp(posts, "post",
"post.date > site.dont_show_posts_before")
assert_equal posts.select { |p| p.date > @sample_time }.count, results.length
assert_equal posts.count { |p| p.date > @sample_time }, results.length
end
end

0 comments on commit 3eab32f

Please sign in to comment.
You can’t perform that action at this time.