Fix typo with instance variable

This commit is contained in:
ccocchi 2012-05-02 17:53:13 +02:00
parent e0d984cac6
commit 961c6ac533
2 changed files with 9 additions and 1 deletions

View File

@ -96,7 +96,7 @@ module RablRails
# missing method.
#
def method_missing(name, *args, &block)
@context.respond_to?(name) ? @context.send(name, *args, &block) : super
@_context.respond_to?(name) ? @_context.send(name, *args, &block) : super
end
#

View File

@ -77,6 +77,14 @@ class TestJsonRenderer < ActiveSupport::TestCase
assert_equal %q({}), render_json_output
end
test "node with context method call" do
@context.stub(:respond_to?).with(:context_method).and_return(true)
@context.stub(:context_method).and_return('marty')
proc = lambda { |object| context_method }
@template.source = { :name => proc }
assert_equal %q({"name":"marty"}), render_json_output
end
test "partial should be evaluated at rendering time" do
# Set assigns
@context.stub(:instance_variable_get).with(:@_assigns).and_return({'user' => @data})