diff --git a/test/unit/lib/chili_project/liquid_test.rb b/test/unit/lib/chili_project/liquid_test.rb index 0108f15ef9164894eef5774472a17b493db24c2d..3425e313a6866c9b03cfd8021998b08c37c8572d 100644 --- a/test/unit/lib/chili_project/liquid_test.rb +++ b/test/unit/lib/chili_project/liquid_test.rb @@ -23,14 +23,26 @@ class ChiliProject::LiquidTest < ActionView::TestCase end end - context "variable_list tag" do + context "variables" do should "render a list of the current variables" do - text = "{% variable_list %}" + text = "{{ variables | to_list }}" formatted = textilizable(text) assert formatted.include?('<ul>'), "Not in a list format" assert formatted.include?('current_user') end + + should "be lazily evaluated" do + text = ["{{ variables | to_list }}"] + text << '{% assign foo = \"bar\" %}' + text << "{{ variables | to_list }}" + formatted = textilizable(text.join("\n")) + + assert (formatted.scan('<ul>').size == 2), "Not in a list format" + assert (formatted.scan('current_user').size == 2) + + assert (formatted.scan('foo').size == 1), "Not updated on added variable" + end end context "child_pages tag" do