Sha256: 51894c51a73815a3baf895d2a24ef1b0c46b079474d2708d8160b5644478bc87

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

Given(/^subdirector(?:y|ies) ("[^"]*"(?:, "[^"]*")*)$/) do |subdirectories|
  subdirectories.
    split(/,\s*/).
    map { |sd| sd.gsub(/^"|"$/, '') }.
    each { |sd| FileUtils::mkdir_p(sd) }
end

Given /^following files:$/ do |table|
  table.hashes.each do |ff|
    FileUtils::mkdir_p(File.dirname(ff[:path]))
    if ff[:source]
      FileUtils::cp(File.join(@orig_wd, ff[:source]), ff[:path])
    elsif ff[:content]
      File.open(ff[:path], 'w') { |f| f.puts(ff[:content]) }
    else
      FileUtils::touch(ff[:path])
    end
  end
end

When /^I run "(.*?)"$/ do |command|
  @shellout = Mixlib::ShellOut.new(command)
  @shellout.run_command
end

Then /^the command succeeds$/ do
  @shellout.error!
end

Then /^following files exist:$/ do |table|
  table.hashes.each do |ff|
    File.exist?(ff[:path]).should be true
    File.read(ff[:path]).should include ff[:content] if ff[:content]
  end
end

Then /^following files do not exist:$/ do |table|
  table.hashes.each do |ff|
    File.exist?(ff[:path]).should be false
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metarake-0.1.1 features/step_definitions/basic.rb
metarake-0.1.0 features/step_definitions/basic.rb