Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

less brittle cucumber features

  • Loading branch information...
commit f562459236bac3ecd8eb47e271d4032ec8973fd1 1 parent 12b8edb
@nevans authored
View
1  .gitignore
@@ -5,3 +5,4 @@ pkg/*
*.pid
tmp/*
vendor
+tags
View
13 features/step_definitions/resque-pool_steps.rb
@@ -38,6 +38,13 @@ def output_or_log(report_log)
end
end
+def worker_processes_for(queues)
+ children_of(background_pid).select do |pid, cmd|
+ retry if cmd =~ /Starting$/
+ cmd =~ /^resque-\d+.\d+.\d+: Waiting for #{queues}$/
+ end
+end
+
def children_of(ppid)
ps = `ps -eo ppid,pid,cmd | grep '^ *#{ppid} '`
ps.split(/\s*\n/).map do |line|
@@ -92,7 +99,7 @@ def children_of(ppid)
Then /^the pool manager should (report|log) that it has started up$/ do |report_log|
keep_trying do
step "the #{output_or_logfiles_string(report_log)} should contain the following lines (with interpolated $PID):", <<-EOF
-resque-pool-manager[$PID]: Resque Pool running in development environment
+resque-pool-manager[$PID]: Resque Pool running in test environment
resque-pool-manager[$PID]: started manager
EOF
end
@@ -121,9 +128,7 @@ def children_of(ppid)
end
Then /^the pool manager should have (\d+) "([^"]*)" worker child processes$/ do |count, queues|
- children_of(background_pid).select do |pid, cmd|
- cmd =~ /^resque-\d+.\d+.\d+: Waiting for #{queues}$/
- end.should have(Integer(count)).members
+ worker_processes_for(queues).should have(Integer(count)).members
end
Then "the pool manager should finish" do
View
1  features/support/aruba_daemon_support.rb
@@ -1,3 +1,4 @@
+require 'aruba/cucumber'
require 'aruba/api'
require 'aruba/process'
View
2  features/support/env.rb
@@ -1 +1 @@
-require 'aruba/cucumber'
+ENV["RAILS_ENV"] = "test"
Please sign in to comment.
Something went wrong with that request. Please try again.