Sha256: 8edc7c83dd1e94436323e7d42e992debda920b9257046f71024f63ef39df0d2b

Contents?: true

Size: 976 Bytes

Versions: 2

Compression:

Stored size: 976 Bytes

Contents

require 'spec_helper'

describe 'Interpolation' do
  let!(:root) { Fabricate :root }

  context 'double quotes' do
    let!(:layout) { Fabricate :application, body: '{% assign var = "#{foo} interpolation" %}{{ var }}' }
    specify { root.render('foo' => 'bar').should == 'bar interpolation' }
  end

  context 'single quotes' do
    let!(:layout) { Fabricate :application, body: '{% assign var = \'#{foo} interpolation\' %}{{ var }}' }
    specify { root.render('foo' => 'bar').should == '#{foo} interpolation' }
  end

  context 'filters' do
    let!(:layout) { Fabricate :application, body: '{% assign var = "#{foo | capitalize} interpolation" %}{{ var }}' }
    specify { root.render('foo' => 'bar').should == 'Bar interpolation' }
  end

  context 'filters with parameters' do
    let!(:layout) { Fabricate :application, body: '{% assign var = "#{foo | minus: 1} interpolation" %}{{ var }}' }
    specify { root.render('foo' => 4).should == '3 interpolation' }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puffer_pages-0.5.1 spec/lib/liquid/interpolation_spec.rb
puffer_pages-0.5.0 spec/lib/liquid/interpolation_spec.rb