diff --git a/features/builder.feature b/features/builder.feature
index e779302c..0b678dd5 100644
--- a/features/builder.feature
+++ b/features/builder.feature
@@ -3,32 +3,51 @@ Feature: Builder
Scenario: Checking built folder for content
Given a built app at "test-app"
- Then "index.html" should exist at "test-app" and include "Comment in layout"
- Then "javascripts/coffee_test.js" should exist at "test-app" and include "Array.prototype.slice"
- Then "index.html" should exist at "test-app" and include "
Welcome
"
- Then "static.html" should exist at "test-app" and include "Static, no code!"
- Then "services/index.html" should exist at "test-app" and include "Services"
- Then "stylesheets/site.css" should exist at "test-app" and include "html, body, div, span"
- Then "stylesheets/site_scss.css" should exist at "test-app" and include "html, body, div, span"
- Then "stylesheets/static.css" should exist at "test-app" and include "body"
- Then "_partial.html" should not exist at "test-app"
- Then "spaces in file.html" should exist at "test-app" and include "spaces"
- Then "images/blank.gif" should exist at "test-app"
- Then "images/Read me (example).txt" should exist at "test-app"
- Then "images/Child folder/regular_file(example).txt" should exist at "test-app"
- Then ".htaccess" should exist at "test-app"
- Then the last exit code should be "0"
+ Then a directory named "build" should exist
+ And the exit status should be 0
+
+ When I cd to "build"
+ Then the following files should exist:
+ | index.html |
+ | javascripts/coffee_test.js |
+ | static.html |
+ | services/index.html |
+ | stylesheets/site.css |
+ | stylesheets/site_scss.css |
+ | stylesheets/static.css |
+ | spaces in file.html |
+ | images/blank.gif |
+ | images/Read me (example).txt |
+ | images/Child folder/regular_file(example).txt |
+ | .htaccess |
+ Then the following files should not exist:
+ | _partial |
+ | _liquid_partial |
+ | layout |
+ | layouts/custom |
+ | layouts/content_for |
+
+ And the file "index.html" should contain "Comment in layout"
+ And the file "index.html" should contain "Welcome
"
+ And the file "javascripts/coffee_test.js" should contain "Array.prototype.slice"
+ And the file "static.html" should contain "Static, no code!"
+ And the file "services/index.html" should contain "Services"
+ And the file "stylesheets/site.css" should contain "html, body, div, span"
+ And the file "stylesheets/site_scss.css" should contain "html, body, div, span"
+ And the file "stylesheets/static.css" should contain "body"
+ And the file "spaces in file.html" should contain "spaces"
Scenario: Build glob
Given a built app at "glob-app" with flags "--glob '*.css'"
- Then "stylesheets/site.css" should exist at "glob-app" and include "html"
- Then "index.html" should not exist at "glob-app"
- Then the last exit code should be "0"
+ Then a directory named "build" should exist
+ And the exit status should be 0
+
+ When I cd to "build"
+ Then the following files should not exist:
+ | index.html |
+ Then the following files should exist:
+ | stylesheets/site.css |
Scenario: Build with errors
Given a built app at "build-with-errors-app"
- Then the last exit code should be "1"
-
- # Scenario: Force relative assets
- # Given a built app at "relative-app" with flags "--relative"
- # Then "stylesheets/relative_assets.css" should exist at "relative-app" and include "../"
+ Then the exit status should be 1
diff --git a/features/clean_build.feature b/features/clean_build.feature
index 268d65db..047d9fc4 100644
--- a/features/clean_build.feature
+++ b/features/clean_build.feature
@@ -13,7 +13,6 @@ Feature: Build Clean
Then "about/index.html" should exist at "clean-dir-app"
Given a built app at "clean-dir-app" with flags "--clean"
Then "about/index.html" should exist at "clean-dir-app"
- Then cleanup built app at "clean-dir-app"
Scenario: Clean build an app that's never been built
Given a built app at "clean-dir-app" with flags "--clean"
diff --git a/features/cli.feature b/features/cli.feature
new file mode 100644
index 00000000..0d86d258
--- /dev/null
+++ b/features/cli.feature
@@ -0,0 +1,5 @@
+Feature: Middleman CLI
+
+ Scenario: Create a new project
+ When I run `middleman init MY_PROJECT`
+
\ No newline at end of file
diff --git a/features/dynamic_pages.feature b/features/dynamic_pages.feature
index 47d0c6a1..f6d750a7 100644
--- a/features/dynamic_pages.feature
+++ b/features/dynamic_pages.feature
@@ -3,13 +3,18 @@ Feature: Dynamic Pages
Scenario: Checking built folder for content
Given a built app at "test-app"
- Then "fake.html" should exist at "test-app" and include "I am real"
- Then "fake/one.html" should exist at "test-app" and include "I am real: one"
- Then "fake/two.html" should exist at "test-app" and include "I am real: two"
- Then "target_ignore.html" should exist at "test-app" and include "Ignore me"
- Then "should_be_ignored.html" should not exist at "test-app"
- Then "should_be_ignored2.html" should not exist at "test-app"
- Then "should_be_ignored3.html" should not exist at "test-app"
+ Then a directory named "build" should exist
+
+ When I cd to "build"
+ Then the following files should exist:
+ | fake.html |
+ | fake/one.html |
+ | fake/two.html |
+ | target_ignore.html |
+ Then the following files should not exist:
+ | should_be_ignored.html |
+ | should_be_ignored2.html |
+ | should_be_ignored3.html |
Scenario: Preview basic proxy
Given the Server is running at "test-app"
diff --git a/features/sprockets.feature b/features/sprockets.feature
index 1d01b85d..92af2704 100644
--- a/features/sprockets.feature
+++ b/features/sprockets.feature
@@ -22,7 +22,9 @@ Feature: Sprockets
Scenario: Multiple engine files should build correctly
Given a built app at "test-app"
- Then "javascripts/multiple_engines.js" should exist at "test-app" and include "Hello One"
+ When I cd to "build"
+ Then a file named "javascripts/multiple_engines.js" should exist
+ And the file "javascripts/multiple_engines.js" should contain "Hello One"
Scenario: Sprockets CSS require //require
Given the Server is running at "test-app"
diff --git a/lib/middleman/step_definitions.rb b/lib/middleman/step_definitions.rb
index 3849750a..42768086 100644
--- a/lib/middleman/step_definitions.rb
+++ b/lib/middleman/step_definitions.rb
@@ -1,6 +1,8 @@
MIDDLEMAN_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
MIDDLEMAN_BIN_PATH = File.join(MIDDLEMAN_ROOT_PATH, "bin")
+ENV['PATH'] = "#{MIDDLEMAN_BIN_PATH}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
+require "aruba/cucumber"
require "middleman/step_definitions/middleman_steps"
require "middleman/step_definitions/builder_steps"
require "middleman/step_definitions/generator_steps"
diff --git a/lib/middleman/step_definitions/builder_steps.rb b/lib/middleman/step_definitions/builder_steps.rb
index 7cf02733..46d53e9e 100644
--- a/lib/middleman/step_definitions/builder_steps.rb
+++ b/lib/middleman/step_definitions/builder_steps.rb
@@ -7,25 +7,23 @@ Given /^app "([^\"]*)" is using config "([^\"]*)"$/ do |path, config_name|
FileUtils.cp(config_path, config_dest)
end
-Given /^a built app at "([^\"]*)"$/ do |path|
- target = File.join(PROJECT_ROOT_PATH, "fixtures", path)
+Given /^a fixture app "([^\"]*)"$/ do |path|
+ step %Q{a directory named "#{path}"}
+
+ target_path = File.join(PROJECT_ROOT_PATH, "fixtures", path)
+ FileUtils.cp_r(target_path, current_dir)
- build_target = File.join(target, "build")
- FileUtils.rm_rf(build_target)
-
- build_cmd = File.join(MIDDLEMAN_BIN_PATH, "middleman build")
- `cd #{target} && #{build_cmd}`
+ step %Q{I cd to "#{path}"}
end
-Then /^cleanup built app at "([^\"]*)"$/ do |path|
- target = File.join(PROJECT_ROOT_PATH, "fixtures", path, "build")
- FileUtils.rm_rf(target)
+Given /^a built app at "([^\"]*)"$/ do |path|
+ step %Q{a fixture app "#{path}"}
+ step %Q{I run `middleman build`}
end
Given /^a built app at "([^\"]*)" with flags "([^\"]*)"$/ do |path, flags|
- target = File.join(PROJECT_ROOT_PATH, "fixtures", path)
- build_cmd = File.join(MIDDLEMAN_BIN_PATH, "middleman build")
- `cd #{target} && #{build_cmd} #{flags}`
+ step %Q{a fixture app "#{path}"}
+ step %Q{I run `middleman build #{flags}`}
end
Then /^"([^\"]*)" should exist at "([^\"]*)"$/ do |target_file, path|
diff --git a/lib/middleman/step_definitions/middleman_steps.rb b/lib/middleman/step_definitions/middleman_steps.rb
index b0c9ed77..8e284a95 100644
--- a/lib/middleman/step_definitions/middleman_steps.rb
+++ b/lib/middleman/step_definitions/middleman_steps.rb
@@ -1,3 +1,5 @@
+require "fileutils"
+
Given /^a project at "([^\"]*)"$/ do |dirname|
@target = File.join(PROJECT_ROOT_PATH, "fixtures", dirname)
end
diff --git a/middleman.gemspec b/middleman.gemspec
index 685096da..3cfc3664 100644
--- a/middleman.gemspec
+++ b/middleman.gemspec
@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
s.add_development_dependency("coffee-filter", ["~> 0.1.1"])
s.add_development_dependency("liquid", ["~> 2.2.0"])
s.add_development_dependency("cucumber", ["~> 1.1.0"])
+ s.add_development_dependency("aruba")
s.add_development_dependency("rake", ["~> 0.9.2"])
s.add_development_dependency("rspec", ["~> 2.7.0"])
s.add_development_dependency("rdoc", ["~> 3.9.4"])