Sha256: 079c57694ad1fc336cb44c24873ae98b42bf3052f0e50b0b9f7e7a7e732f0c26

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

__DIR__ = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))

Given /^the (.+) is on my path$/ do |command|
  @bin_path = File.join(__DIR__, 'bin')
  # (and is executable)
  silent_system("test -x #{@bin_path}/#{command}").should be_true
end

Given /^the "([^\"]*)" directory exists and is writable$/ do |directory|
  File.exists?(directory).should be_true
  File.writable?(directory).should be_true
end

When /^I run "([^\"]*)"$/ do |cmd|
  @root = Pathname.new(File.dirname(__FILE__)).parent.parent.expand_path
  bin_path = @root.join('bin')
  command = "#{bin_path}/#{cmd}"

  @output = `#{command}`
  $?.exitstatus.should == 0
end

Then /^(\d+) instances of "([^\"]*)" should be running$/ do |number, command|
  sleep 0.5 # this truly is a dodgy hack.
            # sometimes the the worker manager can take a while to fork
  output = `ps -eo cmd |grep ^#{command} |grep -v grep`
  output.split.size.should >= number.to_i
end

Given /^there are (\d+) instances of the flapjack\-worker running$/ do |number|
  command = "#{@bin_path}/flapjack-worker-manager start --workers=5"
  silent_system(command).should be_true
end

Given /^there are no instances of flapjack\-worker running$/ do
  command = "#{@bin_path}/flapjack-worker-manager stop"
  silent_system(command)

  sleep 0.5 # again, waiting for the worker manager

  output = `ps -eo cmd |grep ^flapjack-worker |grep -v grep`
  output.split("\n").size.should == 0
end

Given /^beanstalkd is running on localhost$/ do
  output = `ps -eo cmd |grep beanstalkd |grep -v grep`
  output.split("\n").size.should == 1
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flapjack-0.5.5 features/steps/flapjack-worker-manager_steps.rb
flapjack-0.5.4 features/steps/flapjack-worker-manager_steps.rb
flapjack-0.5.3 features/steps/flapjack-worker-manager_steps.rb