Skip to content
This repository has been archived by the owner on Feb 7, 2018. It is now read-only.

Commit

Permalink
Do not expect STDERR in all Runners
Browse files Browse the repository at this point in the history
This one was silly. The test was in command_line_spec, which is to
test thing common to all Runners. But as I pointed out in the
previous commit, only Posix and Process are capable of returning
things from STDERR. So, of course, it fails in JRuby which isn't
capable of running either Runner.

This change moves the test to those Runners' specific tests.
  • Loading branch information
Jon Yurek committed Sep 25, 2015
1 parent ed4b3ab commit cd171cf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
11 changes: 11 additions & 0 deletions spec/cocaine/command_line/runners/posix_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,16 @@
subject.call("ruby -e 'exit 5'")
$?.exitstatus.should == 5
end

it "runs the command it's given and allows access to stderr afterwards" do
cmd = Cocaine::CommandLine.new(
"ruby",
"-e '$stdout.puts %{hello}; $stderr.puts %{goodbye}'",
:swallow_stderr => false
)
cmd.run
expect(cmd.command_output).to eq "hello\n"
expect(cmd.command_error_output).to eq "goodbye\n"
end
end
end
11 changes: 11 additions & 0 deletions spec/cocaine/command_line/runners/process_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,16 @@
subject.call("ruby -e 'exit 5'")
$?.exitstatus.should == 5
end

it "runs the command it's given and allows access to stderr afterwards" do
cmd = Cocaine::CommandLine.new(
"ruby",
"-e '$stdout.puts %{hello}; $stderr.puts %{goodbye}'",
:swallow_stderr => false
)
cmd.run
expect(cmd.command_output).to eq "hello\n"
expect(cmd.command_error_output).to eq "goodbye\n"
end
end
end
11 changes: 0 additions & 11 deletions spec/cocaine/command_line_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,6 @@
expect(cmd.command_output).to eq "hello\n"
end

it "runs the command it's given and allows access to stderr afterwards" do
cmd = Cocaine::CommandLine.new(
"ruby",
"-e '$stdout.puts %{hello}; $stderr.puts %{goodbye}'",
:swallow_stderr => false
)
cmd.run
expect(cmd.command_output).to eq "hello\n"
expect(cmd.command_error_output).to eq "goodbye\n"
end

it "colorizes the output to a tty" do
logger = FakeLogger.new(:tty => true)
Cocaine::CommandLine.new("echo", "'Logging!' :foo", :logger => logger).run(:foo => "bar")
Expand Down

0 comments on commit cd171cf

Please sign in to comment.