Method: Wukong::SpecHelpers::IntegrationTests#command
- Defined in:
- lib/wukong/spec_helpers/integration_tests.rb
#command(*args, options = {}) ⇒ Object
Spawn a command and capture its STDOUT, STDERR, and exit code.
The args will be joined together into a command line.
It is expected that you will use the matchers defined in IntegrationMatchers in your integration tests:
135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/wukong/spec_helpers/integration_tests.rb', line 135 def command *args a = args.flatten.compact = (a.last.is_a?(Hash) ? a.pop : {}) env = ENV.to_hash.dup env.merge!(integration_env) if respond_to?(:integration_env) env.merge!([:env] || {}) cwd = [:cwd] cwd ||= (respond_to?(:integration_cwd) ? integration_cwd : Dir.pwd) IntegrationTestRunner.new(a, cwd: cwd, env: env) end |