Rubocop fixes for test/test_liquid_extensions.rb

This commit is contained in:
Brint O'Hearn 2016-05-15 22:58:06 -05:00
parent 271a8aebfb
commit 5a1a8c9c82
2 changed files with 7 additions and 9 deletions

View File

@ -75,7 +75,6 @@ AllCops:
- test/test_entry_filter.rb - test/test_entry_filter.rb
- test/test_filters.rb - test/test_filters.rb
- test/test_kramdown.rb - test/test_kramdown.rb
- test/test_liquid_extensions.rb
- test/test_liquid_renderer.rb - test/test_liquid_renderer.rb
- test/test_log_adapter.rb - test/test_log_adapter.rb
- test/test_new_command.rb - test/test_new_command.rb

View File

@ -1,12 +1,11 @@
require 'helper' require "helper"
class TestLiquidExtensions < JekyllUnitTest class TestLiquidExtensions < JekyllUnitTest
context "looking up a variable in a Liquid context" do context "looking up a variable in a Liquid context" do
class SayHi < Liquid::Tag class SayHi < Liquid::Tag
include Jekyll::LiquidExtensions include Jekyll::LiquidExtensions
def initialize(tag_name, markup, tokens) def initialize(_tag_name, markup, _tokens)
@markup = markup.strip @markup = markup.strip
end end
@ -14,18 +13,18 @@ class TestLiquidExtensions < JekyllUnitTest
"hi #{lookup_variable(context, @markup)}" "hi #{lookup_variable(context, @markup)}"
end end
end end
Liquid::Template.register_tag('say_hi', SayHi) Liquid::Template.register_tag("say_hi", SayHi)
setup do setup do
@template = Liquid::Template.parse("{% say_hi page.name %}") # Parses and compiles the template # Parses and compiles the template
@template = Liquid::Template.parse("{% say_hi page.name %}")
end end
should "extract the var properly" do should "extract the var properly" do
assert_equal @template.render({'page' => {'name' => 'tobi'}}), 'hi tobi' assert_equal @template.render({ "page" => { "name" => "tobi" } }), "hi tobi"
end end
should "return the variable name if the value isn't there" do should "return the variable name if the value isn't there" do
assert_equal @template.render({'page' => {'title' => 'tobi'}}), 'hi page.name' assert_equal @template.render({ "page" => { "title" => "tobi" } }), "hi page.name"
end end
end end
end end