/
githubmirror
/
jekyll
Обзор
Документация
Войти
/
githubmirror
/
jekyll
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/test_liquid_extensions.rb
32 строки
884 B
Ashwin Maroli
fix incorrectly passed arguments to assert_equal (#7134)
15 июл 2018, 23:11
15 июл 2018, 23:11
506c764
Код
Авторство
О чём код?
# frozen_string_literal: true require "helper" class TestLiquidExtensions < JekyllUnitTest context "looking up a variable in a Liquid context" do class SayHi < Liquid::Tag include Jekyll::LiquidExtensions def initialize(_tag_name, markup, _tokens) @markup = markup.strip end def render(context) "hi #{lookup_variable(context, @markup)}" end end Liquid::Template.register_tag("say_hi", SayHi) setup do # Parses and compiles the template @template = Liquid::Template.parse("{% say_hi page.name %}") end should "extract the var properly" do assert_equal "hi tobi", @template.render("page" => { "name" => "tobi" }) end should "return the variable name if the value isn't there" do assert_equal "hi page.name", @template.render("page" => { "title" => "tobi" }) end end end