Improve test suite performance with aruba wrapper:
* Implement ArubaProgramWrapper in cucumber env; * Tag a few features to not use the wrapper as aruba doesn't support yet interactive testing with in process mode, and reported program name will not be the correct one; * Assign required standard streams to CLI and Env classes.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
Feature: CLI usage
|
||||
|
||||
@exec
|
||||
Scenario: prints the usage when an argument is missing
|
||||
When I run `producer`
|
||||
Then the exit status must be 64
|
||||
|
@@ -1,5 +1,6 @@
|
||||
Feature: `ask' recipe keyword
|
||||
|
||||
@exec
|
||||
Scenario: prompts user with a list of choices on standard output
|
||||
Given a recipe with:
|
||||
"""
|
||||
|
@@ -1,2 +1,34 @@
|
||||
require 'aruba/cucumber'
|
||||
require 'aruba/in_process'
|
||||
require 'cucumber/sshd/cucumber'
|
||||
require 'producer/core'
|
||||
|
||||
|
||||
class ArubaProgramWrapper
|
||||
def initialize(argv, stdin = $stdin, stdout = $stdout, stderr = $stderr,
|
||||
kernel = Kernel)
|
||||
@argv = argv
|
||||
@stdin = stdin
|
||||
@stdout = stdout
|
||||
@stderr = stderr
|
||||
@kernel = kernel
|
||||
end
|
||||
|
||||
def execute!
|
||||
Producer::Core::CLI.run!(
|
||||
@argv.dup, stdin: @stdin, stdout: @stdout, stderr: @stderr
|
||||
)
|
||||
rescue SystemExit => e
|
||||
@kernel.exit(e.status)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Before('@exec') do
|
||||
Aruba.process = Aruba::SpawnProcess
|
||||
end
|
||||
|
||||
Before('~@exec') do
|
||||
Aruba::InProcess.main_class = ArubaProgramWrapper
|
||||
Aruba.process = Aruba::InProcess
|
||||
end
|
||||
|
Reference in New Issue
Block a user