Sha256: ad51ad806bc0b170cbe2af270c19492d8df2919ce2303ef28947026de38109dc

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

Given /^I am in the directory "(.*)"$/ do |sandbox_dir_relative_path|
  path = File.join(SporkWorld::SANDBOX_DIR, sandbox_dir_relative_path)
  FileUtils.mkdir_p(path)
  @current_dir = File.join(path)
end

Given /^a file named "([^\"]*)"$/ do |file_name|
  create_file(file_name, '')
end

Given /^a file named "([^\"]*)" with:$/ do |file_name, file_content|
  create_file(file_name, file_content)
end

When /^I run (spork|spec)($| .*$)/ do |command, spork_opts|
  if command == 'spork'
    command = SporkWorld::BINARY
  else
    command = %x{which #{command}}.chomp
  end
  run "#{SporkWorld::RUBY_BINARY} #{command} #{spork_opts}"
end

When /^I fire up a spork instance with "spork(.*)"$/ do |spork_opts|
  run_in_background "#{SporkWorld::RUBY_BINARY} #{SporkWorld::BINARY} #{spork_opts}"
  output = ""
  begin
    status = Timeout::timeout(15) do
      # Something that should be interrupted if it takes too much time...
      while line = @bg_stderr.gets
        output << line
        puts line
        break if line.include?("Spork is ready and listening")
      end
    end
  rescue Timeout::Error
    puts "I can't seem to launch Spork properly.  Output was:\n#{output}"
    true.should == false
  end
end

Then /^the output should contain$/ do |text|
  last_stdout.should include(text)
end

Then /^the output should contain "(.+)"$/ do |text|
  last_stdout.should include(text)
end

Then /^the output should not contain$/ do |text|
  last_stdout.should_not include(text)
end

Then /^the output should not contain "(.+)"$/ do |text|
  last_stdout.should_not include(text)
end

Then /^the output should be$/ do |text|
  last_stdout.should == text
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
timcharper-spork-0.5.0 features/steps/sandbox_steps.rb