Fix RuboCop Performance offenses in test files (#7839)

* Replace select.first with find
* Replace select.count with count
This commit is contained in:
Takashi Udagawa 2019-10-06 15:30:25 +09:00 committed by Ashwin Maroli
parent de6548f1ba
commit 3eab32fad7
2 changed files with 2 additions and 2 deletions

View File

@ -175,7 +175,7 @@ class TestDocument < JekyllUnitTest
}]
)
@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

View File

@ -1036,7 +1036,7 @@ class TestFilters < JekyllUnitTest
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