| @@ -54,6 +54,35 @@ shared_examples_for LiquidInterpolatable do | ||
| 54 | 54 |        @checker.interpolate_string("{{variable}}", @event).should == "hello" | 
| 55 | 55 |        @checker.interpolate_string("{{variable}} you", @event).should == "hello you" | 
| 56 | 56 | end | 
| 57 | + | |
| 58 | + it "should use local variables while in a block" do | |
| 59 | +      @checker.options['locals'] = '{{_foo_}} {{_bar_}}' | |
| 60 | + | |
| 61 | +      @checker.interpolation_context.tap { |context| | |
| 62 | + @checker.interpolated['locals'].should == ' ' | |
| 63 | + | |
| 64 | +        context.stack { | |
| 65 | + context['_foo_'] = 'This is' | |
| 66 | + context['_bar_'] = 'great.' | |
| 67 | + | |
| 68 | + @checker.interpolated['locals'].should == 'This is great.' | |
| 69 | + } | |
| 70 | + | |
| 71 | + @checker.interpolated['locals'].should == ' ' | |
| 72 | + } | |
| 73 | + end | |
| 74 | + | |
| 75 | + it "should use another self object while in a block" do | |
| 76 | +      @checker.options['properties'] = '{{_foo_}} {{_bar_}}' | |
| 77 | + | |
| 78 | + @checker.interpolated['properties'].should == ' ' | |
| 79 | + | |
| 80 | +      @checker.interpolate_with({ '_foo_' => 'That was', '_bar_' => 'nice.' }) { | |
| 81 | + @checker.interpolated['properties'].should == 'That was nice.' | |
| 82 | + } | |
| 83 | + | |
| 84 | + @checker.interpolated['properties'].should == ' ' | |
| 85 | + end | |
| 57 | 86 | end | 
| 58 | 87 |  | 
| 59 | 88 | describe "liquid tags" do |