From 6e84a7abe8a94068c9e5ce380cf344367ad08ef4 Mon Sep 17 00:00:00 2001 From: Norman Clarke Date: Tue, 29 May 2012 00:17:14 -0300 Subject: [PATCH] Silence some warnings about unused vars --- test/engine_test.rb | 3 +++ test/filters_test.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/engine_test.rb b/test/engine_test.rb index c5dae1be..1ffbd64d 100644 --- a/test/engine_test.rb +++ b/test/engine_test.rb @@ -1264,6 +1264,9 @@ HAML string.instance_variable_set("@var", "Instance variable") b = string.instance_eval do var = "Local variable" + # Silence unavoidable warning; Ruby doesn't know we're going to use this + # later. + nil if var binding end diff --git a/test/filters_test.rb b/test/filters_test.rb index f2d92e42..50aabfa8 100644 --- a/test/filters_test.rb +++ b/test/filters_test.rb @@ -84,14 +84,14 @@ class ErbFilterTest < MiniTest::Unit::TestCase test "should evaluate in the same context as Haml" do haml = ":erb\n <%= foo %>" html = "bar\n" - scope = Object.new.instance_eval {foo = "bar"; binding} + scope = Object.new.instance_eval {foo = "bar"; nil if foo; binding} assert_equal(html, render(haml, :scope => scope)) end end class JavascriptFilterTest < MiniTest::Unit::TestCase test "should interpolate" do - scope = Object.new.instance_eval {foo = "bar"; binding} + scope = Object.new.instance_eval {foo = "bar"; nil if foo; binding} haml = ":javascript\n \#{foo}" html = render(haml, :scope => scope) assert_match(/bar/, html)