Sha256: a2053bd45eb8bfaea95fd6bb0dae7ff8481d5e381c0d9faf893a77b07546feca
Contents?: true
Size: 748 Bytes
Versions: 6
Compression:
Stored size: 748 Bytes
Contents
require 'spec_helper' module Liquid module Rails describe MiscFilter do let(:context) { ::Liquid::Context.new } context '#index' do it 'returns value at the specified index' do context['array'] = [1, 2, 3] expect(::Liquid::Variable.new("array | index: 0").render(context)).to eq(1) end it 'returns nil when outside range' do context['array'] = [1, 2, 3] expect(::Liquid::Variable.new("array | index: 5").render(context)).to eq(nil) end end it '#jsonify' do context['listing'] = { name: 'Listing A' } expect(::Liquid::Variable.new("listing | jsonify").render(context)).to eq(%|{"name":"Listing A"}|) end end end end
Version data entries
6 entries across 6 versions & 2 rubygems