From 013e2f159d583cf635448e6cdf8fc050d572b7a1 Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Thu, 19 May 2016 20:32:56 -0500 Subject: [PATCH] Rubocop fixes for test/test_url.rb --- .rubocop.yml | 1 - test/test_url.rb | 46 ++++++++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ac3c8300..020e4f92 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -84,7 +84,6 @@ AllCops: - test/test_static_file.rb - test/test_tags.rb - test/test_theme.rb - - test/test_url.rb - test/test_utils.rb - bin/**/* - benchmark/**/* diff --git a/test/test_url.rb b/test/test_url.rb index 99ee5e61..fc9a46eb 100644 --- a/test/test_url.rb +++ b/test/test_url.rb @@ -1,8 +1,7 @@ -require 'helper' +require "helper" class TestURL < JekyllUnitTest context "The URL class" do - should "throw an exception if neither permalink or template is specified" do assert_raises ArgumentError do URL.new(:placeholders => {}) @@ -11,46 +10,46 @@ class TestURL < JekyllUnitTest should "replace placeholders in templates" do assert_equal "/foo/bar", URL.new( - :template => "/:x/:y", - :placeholders => {:x => "foo", :y => "bar"} + :template => "/:x/:y", + :placeholders => { :x => "foo", :y => "bar" } ).to_s end should "handle multiple of the same key in the template" do - assert_equal '/foo/bar/foo/', URL.new( - :template => "/:x/:y/:x/", - :placeholders => {:x => "foo", :y => "bar"} + assert_equal "/foo/bar/foo/", URL.new( + :template => "/:x/:y/:x/", + :placeholders => { :x => "foo", :y => "bar" } ).to_s end should "use permalink if given" do assert_equal "/le/perma/link", URL.new( - :template => "/:x/:y", - :placeholders => {:x => "foo", :y => "bar"}, - :permalink => "/le/perma/link" + :template => "/:x/:y", + :placeholders => { :x => "foo", :y => "bar" }, + :permalink => "/le/perma/link" ).to_s end should "replace placeholders in permalinks" do assert_equal "/foo/bar", URL.new( - :template => "/baz", - :permalink => "/:x/:y", - :placeholders => {:x => "foo", :y => "bar"} + :template => "/baz", + :permalink => "/:x/:y", + :placeholders => { :x => "foo", :y => "bar" } ).to_s end should "handle multiple of the same key in the permalink" do - assert_equal '/foo/bar/foo/', URL.new( - :template => "/baz", - :permalink => "/:x/:y/:x/", - :placeholders => {:x => "foo", :y => "bar"} + assert_equal "/foo/bar/foo/", URL.new( + :template => "/baz", + :permalink => "/:x/:y/:x/", + :placeholders => { :x => "foo", :y => "bar" } ).to_s end should "handle nil values for keys in the template" do - assert_equal '/foo/bar/', URL.new( - :template => "/:x/:y/:z/", - :placeholders => {:x => "foo", :y => "bar", :z => nil} + assert_equal "/foo/bar/", URL.new( + :template => "/:x/:y/:z/", + :placeholders => { :x => "foo", :y => "bar", :z => nil } ).to_s end @@ -60,17 +59,16 @@ class TestURL < JekyllUnitTest "methods" => { "output" => true } - }, + } }) site.read matching_doc = site.collections["methods"].docs.find do |doc| doc.relative_path == "_methods/escape-+ #%20[].md" end - assert_equal '/methods/escape-+-20/escape-20.html', URL.new( - :template => '/methods/:title/:name:output_ext', + assert_equal "/methods/escape-+-20/escape-20.html", URL.new( + :template => "/methods/:title/:name:output_ext", :placeholders => matching_doc.url_placeholders ).to_s end - end end