Fix tests.

This commit is contained in:
Markus Reiter 2018-06-14 22:45:07 +02:00
parent b45996dada
commit 502b393d66

View File

@ -66,10 +66,10 @@ describe Hbc::SystemCommand, :cask do
describe "with default options" do describe "with default options" do
it "echoes only STDERR" do it "echoes only STDERR" do
expected = [2, 4, 6].map { |i| "==> #{i}\n" }.join("") expected = [2, 4, 6].map { |i| "#{i}\n" }.join
expect { expect {
described_class.run(command, options) described_class.run(command, options)
}.to output(expected).to_stdout }.to output(expected).to_stderr
end end
include_examples("it returns '1 2 3 4 5 6'") include_examples("it returns '1 2 3 4 5 6'")
@ -80,12 +80,10 @@ describe Hbc::SystemCommand, :cask do
options.merge!(print_stdout: true) options.merge!(print_stdout: true)
end end
it "echoes both STDOUT and STDERR" do it "echoes both STDOUT and STDERR", :focus do
(1..6).each do |i| expect { described_class.run(command, options) }
expect { .to output("1\n3\n5\n").to_stdout
described_class.run(command, options) .and output("2\n4\n6\n").to_stderr
}.to output(/==> #{ i }/).to_stdout
end
end end
include_examples("it returns '1 2 3 4 5 6'") include_examples("it returns '1 2 3 4 5 6'")
@ -111,7 +109,7 @@ describe Hbc::SystemCommand, :cask do
end end
it "echoes only STDOUT" do it "echoes only STDOUT" do
expected = [1, 3, 5].map { |i| "==> #{i}\n" }.join("") expected = [1, 3, 5].map { |i| "#{i}\n" }.join("")
expect { expect {
described_class.run(command, options) described_class.run(command, options)
}.to output(expected).to_stdout }.to output(expected).to_stdout