Fix Rubocop warnings

This commit is contained in:
Marko Locher 2016-07-14 12:15:00 +02:00
parent 49e97ef9b0
commit 73223f3a5a
2 changed files with 14 additions and 5 deletions

View File

@ -14,7 +14,8 @@ module Jekyll
"'#{name}' does not contain valid date and/or title." "'#{name}' does not contain valid date and/or title."
end end
@name_regex = %r!^_posts/#{path}#{date}-#{slug}\.[^.]+|^#{path}_posts/?#{date}-#{slug}\.[^.]+! @name_regex = %r!^_posts/#{path}#{date}-#{slug}\.[^.]+|
^#{path}_posts/?#{date}-#{slug}\.[^.]+!x
end end
def post_date def post_date

View File

@ -596,19 +596,27 @@ title: Deprecated Post linking
- 1 {% post_url 2008-11-21-nested %} - 1 {% post_url 2008-11-21-nested %}
CONTENT CONTENT
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true}) create_post(content, {
"permalink" => "pretty",
"source" => source_dir,
"destination" => dest_dir,
"read_posts" => true
})
end end
should "not cause an error" do should "not cause an error" do
refute_match(/markdown\-html\-error/, @result) refute_match(%r!markdown\-html\-error!, @result)
end end
should "have the url to the \"nested\" post from 2008-11-21" do should "have the url to the \"nested\" post from 2008-11-21" do
assert_match %r{1\s/2008/11/21/nested/}, @result assert_match %r!1\s/2008/11/21/nested/!, @result
end end
should "throw a deprecation warning" do should "throw a deprecation warning" do
deprecation_warning = " Deprecation: A call to '{{ post_url 2008-11-21-nested }}' did not match a post using the new matching method of checking name (path-date-slug) equality. Please make sure that you change this tag to match the post's name exactly." deprecation_warning = " Deprecation: A call to "\
"'{{ post_url 2008-11-21-nested }}' did not match a post using the new matching "\
"method of checking name (path-date-slug) equality. Please make sure that you "\
"change this tag to match the post's name exactly."
assert_includes Jekyll.logger.messages, deprecation_warning assert_includes Jekyll.logger.messages, deprecation_warning
end end
end end