the json liquid filter requires the content entry collection liquid drop to have a map method

did committed May 11, 2016
commit bbc62a3671d19687ae7546f4247fdc1780b67ca0
Showing 2 changed files with 5 additions and 1 deletions
locomotive/steam/liquid/drops/content_entry_collection.rb b/lib/locomotive/steam/liquid/drops/content_entry_collection.rb +1 -1
@@ @@ -5,7 +5,7 @@ module Locomotive
class ContentEntryCollection < ::Liquid::Drop
- delegate :first, :last, :each, :each_with_index, :empty?, :any?, to: :collection
+ delegate :first, :last, :each, :each_with_index, :empty?, :any?, :map, to: :collection
def initialize(content_type, repository = nil)
@content_type = content_type
spec/unit/liquid/drops/content_entry_collection_spec.rb +4 -0
@@ @@ -32,6 +32,10 @@ describe Locomotive::Steam::Liquid::Drops::ContentEntryCollection do
it { expect(drop.last).to eq('b') }
end
+ describe '#last' do
+ it { expect(drop.map(&:to_s)).to eq(['a', 'b']) }
+ end
+
context 'with a scope' do
let(:assigns) { { 'with_scope' => { 'visible' => true } } }