expose the handle property of a site in Liquid
Didier Lafforgue
committed May 02, 2018
commit 747f3559523ac96091347535649346d6ee8b7838
Showing 2
changed files with
3 additions
and 2 deletions
locomotive/steam/liquid/drops/site.rb b/lib/locomotive/steam/liquid/drops/site.rb
+1
-1
| @@ | @@ -4,7 +4,7 @@ module Locomotive |
| module Drops | |
| class Site < I18nBase | |
| - | delegate :name, :domains, :seo_title, :meta_keywords, :meta_description, :asset_host, to: :@_source |
| + | delegate :name, :handle, :domains, :seo_title, :meta_keywords, :meta_description, :asset_host, to: :@_source |
| def index | |
| @index ||= repository.root.to_liquid | |
spec/unit/liquid/drops/site_spec.rb
+2
-1
| @@ | @@ -4,13 +4,14 @@ describe Locomotive::Steam::Liquid::Drops::Site do |
| let(:services) { Locomotive::Steam::Services.build_instance } | |
| let(:context) { ::Liquid::Context.new({}, {}, { services: services }) } | |
| - | let(:site) { instance_double('Site', name: 'Locomotive', domains: ['acme.org'], seo_title: 'seo title', meta_keywords: 'keywords', meta_description: 'description', localized_attributes: {}, asset_host: 'http://asset.dev') } |
| + | let(:site) { instance_double('Site', handle: 'locomotive', name: 'Locomotive', domains: ['acme.org'], seo_title: 'seo title', meta_keywords: 'keywords', meta_description: 'description', localized_attributes: {}, asset_host: 'http://asset.dev') } |
| let(:drop) { described_class.new(site).tap { |d| d.context = context } } | |
| subject { drop } | |
| it 'gives access to general attributes' do | |
| expect(subject.name).to eq 'Locomotive' | |
| + | expect(subject.handle).to eq 'locomotive' |
| expect(subject.seo_title).to eq 'seo title' | |
| expect(subject.meta_keywords).to eq 'keywords' | |
| expect(subject.meta_description).to eq 'description' | |