[DRE-commits] [ruby-aruba] 72/98: Fixes old use of instance variable #341
Hideki Yamane
henrich at moszumanska.debian.org
Tue Mar 22 12:20:42 UTC 2016
This is an automated email from the git hooks/post-receive script.
henrich pushed a commit to branch debian/sid
in repository ruby-aruba.
commit 9cf22aea2652062341333ddb6a4d31c25524cea2
Author: Dennis Günnewig <dg1 at ratiodata.de>
Date: Mon Jan 25 11:09:45 2016 +0100
Fixes old use of instance variable #341
---
features/api/command/stderr.feature | 46 ++++++++++++++++++++++++++++++++++++
features/api/command/stdout.feature | 46 ++++++++++++++++++++++++++++++++++++
lib/aruba/processes/spawn_process.rb | 4 ++--
3 files changed, 94 insertions(+), 2 deletions(-)
diff --git a/features/api/command/stderr.feature b/features/api/command/stderr.feature
new file mode 100644
index 0000000..3b95a12
--- /dev/null
+++ b/features/api/command/stderr.feature
@@ -0,0 +1,46 @@
+Feature: Access STDERR of command
+
+ You may need to `#stop_all_commands` before accessing `#stderr` of a single
+ command - e.g. `#last_command_started`.
+
+ Background:
+ Given I use a fixture named "cli-app"
+ And the default aruba io wait timeout is 1 seconds
+
+ Scenario: Existing executable
+ Given an executable named "bin/cli" with:
+ """bash
+ #!/bin/bash
+ echo 'Hello, Aruba!' >&2
+ """
+ And a file named "spec/run_spec.rb" with:
+ """ruby
+ require 'spec_helper'
+
+ RSpec.describe 'Run command', :type => :aruba do
+ before(:each) { run('cli') }
+ before(:each) { stop_all_commands }
+ it { expect(last_command_started.stderr).to start_with 'Hello' }
+ end
+ """
+ When I run `rspec`
+ Then the specs should all pass
+
+ Scenario: Waiting for output to "appear" after 2 seconds
+ Given an executable named "bin/cli" with:
+ """bash
+ #!/bin/bash
+ sleep 1
+ echo 'Hello, Aruba' >&2
+ """
+ And a file named "spec/run_spec.rb" with:
+ """ruby
+ require 'spec_helper'
+
+ RSpec.describe 'Run command', :type => :aruba, :io_wait_timeout => 2 do
+ before(:each) { run('cli') }
+ it { expect(last_command_started.stderr).to start_with 'Hello' }
+ end
+ """
+ When I run `rspec`
+ Then the specs should all pass
diff --git a/features/api/command/stdout.feature b/features/api/command/stdout.feature
new file mode 100644
index 0000000..150a893
--- /dev/null
+++ b/features/api/command/stdout.feature
@@ -0,0 +1,46 @@
+Feature: Access STDOUT of command
+
+ You may need to `#stop_all_commands` before accessing `#stdout` of a single
+ command - e.g. `#last_command_started`.
+
+ Background:
+ Given I use a fixture named "cli-app"
+ And the default aruba io wait timeout is 1 seconds
+
+ Scenario: Existing executable
+ Given an executable named "bin/cli" with:
+ """bash
+ #!/bin/bash
+ echo 'Hello, Aruba!'
+ """
+ And a file named "spec/run_spec.rb" with:
+ """ruby
+ require 'spec_helper'
+
+ RSpec.describe 'Run command', :type => :aruba do
+ before(:each) { run('cli') }
+ before(:each) { stop_all_commands }
+ it { expect(last_command_started.stdout).to start_with 'Hello' }
+ end
+ """
+ When I run `rspec`
+ Then the specs should all pass
+
+ Scenario: Waiting for output to "appear" after 2 seconds
+ Given an executable named "bin/cli" with:
+ """bash
+ #!/bin/bash
+ sleep 1
+ echo 'Hello, Aruba'
+ """
+ And a file named "spec/run_spec.rb" with:
+ """ruby
+ require 'spec_helper'
+
+ RSpec.describe 'Run command', :type => :aruba, :io_wait_timeout => 2 do
+ before(:each) { run('cli') }
+ it { expect(last_command_started.stdout).to start_with 'Hello' }
+ end
+ """
+ When I run `rspec`
+ Then the specs should all pass
diff --git a/lib/aruba/processes/spawn_process.rb b/lib/aruba/processes/spawn_process.rb
index 229300f..c6e236a 100644
--- a/lib/aruba/processes/spawn_process.rb
+++ b/lib/aruba/processes/spawn_process.rb
@@ -114,7 +114,7 @@ module Aruba
def stdout(opts = {})
return @stdout_cache if stopped?
- wait_for_io opts.fetch(:wait_for_io, @io_wait) do
+ wait_for_io opts.fetch(:wait_for_io, io_wait_timeout) do
@process.io.stdout.flush
open(@stdout_file.path).read
end
@@ -133,7 +133,7 @@ module Aruba
def stderr(opts = {})
return @stderr_cache if stopped?
- wait_for_io opts.fetch(:wait_for_io, @io_wait) do
+ wait_for_io opts.fetch(:wait_for_io, io_wait_timeout) do
@process.io.stderr.flush
open(@stderr_file.path).read
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-aruba.git
More information about the Pkg-ruby-extras-commits
mailing list