Cache parsed markup parts to avoid repeated calls during template render

This commit is contained in:
Jason Hiltz-Laforge
2014-07-21 15:55:06 +00:00
parent 44b9ad604f
commit 0df3f1c372
3 changed files with 30 additions and 8 deletions
+10
View File
@@ -473,4 +473,14 @@ class ContextUnitTest < Test::Unit::TestCase
assert mock_empty.has_been_called?
end
def test_variable_lookup_caches_markup
mock_scan = Spy.on_instance_method(String, :scan).and_return(["string"])
@context['string'] = 'string'
@context['string']
@context['string']
assert_equal 1, mock_scan.calls.size
end
end # ContextTest