Sha256: 25aaeccd278f32bf0cfb57a3cc0cb290c49fc2069bc8bd01df36b35fb1ecca37

Contents?: true

Size: 1.86 KB

Versions: 25

Compression:

Stored size: 1.86 KB

Contents

require 'fileutils'

Given /^app "([^"]*)" is using config "([^"]*)"$/ do |path, config_name|
  root = File.dirname(File.dirname(File.dirname(__FILE__)))
  target = File.join(root, "fixtures", path)
  config_path = File.join(target, "config-#{config_name}.rb")
  config_dest = File.join(target, "config.rb")
  FileUtils.cp(config_path, config_dest)
end

Given /^a built app at "([^"]*)"$/ do |path|
  root = File.dirname(File.dirname(File.dirname(__FILE__)))
  target = File.join(root, "fixtures", path)
  build_cmd = File.expand_path(File.join(root, "bin", "middleman build"))
  `cd #{target} && #{build_cmd}`
end

Then /^cleanup built app at "([^"]*)"$/ do |path|
  root = File.dirname(File.dirname(File.dirname(__FILE__)))
  target = File.join(root, "fixtures", path, "build")
  FileUtils.rm_rf(target)
end

Given /^a built app at "([^"]*)" with flags "([^"]*)"$/ do |path, flags|
  root = File.dirname(File.dirname(File.dirname(__FILE__)))
  target = File.join(root, "fixtures", path)
  build_cmd = File.expand_path(File.join(root, "bin", "middleman build"))
  `cd #{target} && #{build_cmd} #{flags}`
end

Then /^"([^"]*)" should exist at "([^"]*)"$/ do |target_file, path|
  root = File.dirname(File.dirname(File.dirname(__FILE__)))
  target = File.join(root, "fixtures", path, "build", target_file)
  File.exists?(target).should be_true
end

Then /^"([^"]*)" should exist at "([^"]*)" and include "([^"]*)"$/ do |target_file, path, expected|
  root = File.dirname(File.dirname(File.dirname(__FILE__)))
  target = File.join(root, "fixtures", path, "build", target_file)
  File.exists?(target).should be_true
  File.read(target).should include(expected)
end

Then /^"([^"]*)" should not exist at "([^"]*)"$/ do |target_file, path|
  root = File.dirname(File.dirname(File.dirname(__FILE__)))
  target = File.join(root, "fixtures", path, "build", target_file)
  File.exists?(target).should be_false
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
middleman-2.0.14.pre features/step_definitions/builder_steps.rb
middleman-2.0.13.1-x86-mingw32 features/step_definitions/builder_steps.rb
middleman-2.0.13.1 features/step_definitions/builder_steps.rb
middleman-2.0.13-x86-mingw32 features/step_definitions/builder_steps.rb
middleman-2.0.13 features/step_definitions/builder_steps.rb