Sha256: ab2520602172b298c1246110e8854e82615a7ed24de79aff1aa092f420ddc6c6

Contents?: true

Size: 792 Bytes

Versions: 17

Compression:

Stored size: 792 Bytes

Contents

require 'spec_helper'
 
describe Locomotive::Liquid::Tags::WithScope do
  
  it 'should decode options (boolean, interger, ...)' do
    scope = Locomotive::Liquid::Tags::WithScope.new('with_scope', 'active:true price:42 title:\'foo\' hidden:false', ["{% endwith_scope %}"])    
    attributes = scope.send(:decode, scope.instance_variable_get(:@attributes))
    attributes['active'].should == true
    attributes['price'].should == 42
    attributes['title'].should == 'foo'
    attributes['hidden'].should == false
  end
  
  it 'should store attributes in the context' do
    template = ::Liquid::Template.parse("{% with_scope active:true title:'foo' %}{{ with_scope.active }}-{{ with_scope.title }}{% endwith_scope %}")
    text = template.render
    text.should == "true-foo"
  end
  
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
locomotive_cms-0.0.3.3 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.3.1 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.2.9 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.2.8 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.2.7 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.2.6 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.2.5 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.2.4 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.2.3 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.2.2 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.2.1 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.2 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.1.4 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.1.3 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.1.2 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.1.1 spec/lib/locomotive/liquid/tags/with_scope_spec.rb
locomotive_cms-0.0.1 spec/lib/locomotive/liquid/tags/with_scope_spec.rb