Sha256: 86197b6cb8148bb555024ea2cf0cf3b25f633e947e50f7a42a2206cbc8779dfe

Contents?: true

Size: 562 Bytes

Versions: 3

Compression:

Stored size: 562 Bytes

Contents

require "open3"
require "#{ENV['HOME']}/.ruby_learner/workshop/lib/workplace.rb"

RSpec.describe "STDIN-check" do
  it 'given [3, 6, 9], return "3\n6\n9\n[3, 6, 9]\n"' do
    allow(STDIN).to receive(:readlines) { [3, 6, 9] }
    expect { standard_input() }.to output("3\n6\n9\n[3, 6, 9]\n").to_stdout
  end
  it 'given ["fizz", "buzz"], return "fizz\nbuzz\n[\"fizz\\n\", \"buzz\\n\"]\n"' do
    allow(STDIN).to receive(:readlines) { ["fizz\n", "buzz\n"] }
    expect { standard_input() }.to output("fizz\nbuzz\n[\"fizz\\n\", \"buzz\\n\"]\n").to_stdout
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_learner-1.2.0 contents/questions/sequential_check/section_3/part_2/spec/workplace_spec.rb
ruby_learner-1.1.15 questions/sequential_check/section_3/part_2/spec/workplace_spec.rb
ruby_learner-1.1.14 questions/sequential_check/section_3/part_2/spec/workplace_spec.rb