Sha256: da690b7cf042f2c097273b2289883d9e878d935208d147269f07e200a28ca4b5
Contents?: true
Size: 1.25 KB
Versions: 66
Compression:
Stored size: 1.25 KB
Contents
require 'spec_helper' def command(cmd) Specinfra::Runner.run_command(cmd) end shared_examples "IO checks" do let (:generator) { "seq 1 #{max}" } let (:expected) { (1..max).map { |x| x.to_s }.join("\n") << "\n" } it "stdout only" do out = command(generator).stdout expect(out).to eq expected end it "stderr only" do out = command("#{generator} >&2" ).stderr expect(out).to eq expected end it "stdout then stderr" do cmd = command("#{generator}; #{generator} >&2" ) expect(cmd.stdout).to eq expected expect(cmd.stderr).to eq expected end it "stderr then stdout" do cmd = command("#{generator} >&2; #{generator}" ) expect(cmd.stdout).to eq expected expect(cmd.stderr).to eq expected end it "stdout and stderr" do cmd = command("(#{generator} &); #{generator} >&2; sleep 2" ) expect(cmd.stdout).to eq expected expect(cmd.stderr).to eq expected end end describe "buffer overflow problem" do context "with small output amount" do let (:max) { 10 } include_examples "IO checks" end context "with huge output amount" do let (:max) { 999999 } include_examples "IO checks" end end
Version data entries
66 entries across 66 versions & 3 rubygems