diff --git a/features/create_sites.feature b/features/create_sites.feature index 16e733b16..a25a0d32e 100644 --- a/features/create_sites.feature +++ b/features/create_sites.feature @@ -44,6 +44,17 @@ Feature: Create sites Then the _site directory should exist And I should see "Post Layout:

The only winning move is not to play.

" in "_site/2009/03/27/wargames.html" + Scenario: Basic site with layout inside a subfolder and a post + Given I have a _layouts directory + And I have a _posts directory + And I have the following posts: + | title | date | layout | content | + | Wargames | 2009-03-27 | post/simple | The only winning move is not to play. | + And I have a post/simple layout that contains "Post Layout: {{ content }}" + When I run jekyll + Then the _site directory should exist + And I should see "Post Layout:

The only winning move is not to play.

" in "_site/2009/03/27/wargames.html" + Scenario: Basic site with layouts, pages, posts and files Given I have a _layouts directory And I have a page layout that contains "Page {{ page.title }}: {{ content }}" diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 3604f5230..4e11aad90 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -38,7 +38,12 @@ Given /^I have an? (.*) (layout|theme) that contains "(.*)"$/ do |name, type, te else '_theme' end - File.open(File.join(folder, name + '.html'), 'w') do |f| + destination_file = File.join(folder, name + '.html') + destination_path = File.dirname(destination_file) + unless File.exist?(destination_path) + FileUtils.mkdir_p(destination_path) + end + File.open(destination_file, 'w') do |f| f.write(text) end end