fix issue #130
did
committed Nov 06, 2013
commit 7ec2571c652c06b44e15fc567bece22f218d597d
Showing 3
changed files with
20 additions
and 2 deletions
locomotive/wagon/generators/snippet.rb b/lib/locomotive/wagon/generators/snippet.rb
+4
-2
| @@ | @@ -32,8 +32,10 @@ module Locomotive |
| def create_snippet | |
| extension = self.haml ? 'liquid.haml' : 'liquid' | |
| - | options = { slug: slug, translated: false } |
| - | file_path = File.join(pages_path, slug) |
| + | _slug = slug.clone.downcase.gsub(/[-]/, '_') |
| + | |
| + | options = { slug: _slug, translated: false } |
| + | file_path = File.join(pages_path, _slug) |
| template "template.#{extension}.tt", "#{file_path}.#{extension}", options | |
spec/fixtures/default/app/views/pages/index.liquid.haml
+2
-0
| @@ | @@ -95,4 +95,6 @@ title: Home page |
| {% include footer %} | |
| + | {% include a_complicated_one %} |
| + | |
| {% google_analytics 'UA-20661758-1' %} | |
spec/integration/server/basic_spec.rb
+14
-0
| @@ | @@ -74,6 +74,20 @@ describe Locomotive::Wagon::Server do |
| last_response.body.should =~ /<li>A song template<\/li>/ | |
| end | |
| + | describe 'snippets' do |
| + | |
| + | it 'includes a basic snippet' do |
| + | get '/' |
| + | last_response.body.should =~ /All photos are licensed under Creative Commons\./ |
| + | end |
| + | |
| + | it 'includes a snippet whose name is composed of dash' do |
| + | get '/' |
| + | last_response.body.should =~ /<p>A complicated one name indeed.<\/p>/ |
| + | end |
| + | |
| + | end |
| + | |
| describe 'nav' do | |
| subject { get '/all'; last_response.body } | |