do not memoize the pages of the site liquid drop (fix issue locomotivecms/wagon#281)

did committed Dec 15, 2015
commit 498876db169802d20185ed22563f7bd86d80b2d8
Showing 2 changed files with 7 additions and 1 deletions
locomotive/steam/liquid/drops/site.rb b/lib/locomotive/steam/liquid/drops/site.rb +1 -1
@@ @@ -11,7 +11,7 @@ module Locomotive
end
def pages
- @pages ||= liquify(*self.scoped_pages)
+ liquify(*self.scoped_pages)
end
protected
spec/unit/liquid/drops/site_spec.rb +6 -0
@@ @@ -44,6 +44,12 @@ describe Locomotive::Steam::Liquid::Drops::Site do
it { expect(subject.pages).to eq([{ 'title' => 'About us' }, { 'title' => 'Contact' }]) }
+ it "doesn't memoize it" do
+ subject.pages
+ allow(services.repositories.page).to receive(:all).and_return([pages.first])
+ expect(subject.pages).to eq([{ 'title' => 'About us' }])
+ end
+
end
end