Sha256: 543e47383215dbe192075c7fe525291293208567d421ec8e45991694e23f9562
Contents?: true
Size: 792 Bytes
Versions: 18
Compression:
Stored size: 792 Bytes
Contents
# frozen_string_literal: true RSpec.describe(ScriptCore::ServiceChannel) do let(:writer) { instance_double(IO, "writer") } let(:reader) { instance_double(IO, "reader") } let(:service_channel) do ScriptCore::ServiceChannel.new(writer, reader) end it "forwards #write to the writer" do allow(writer).to receive(:write).and_return(writer) expect(service_channel.write("hello")).to eq(nil) expect(writer).to have_received(:write).with("hello") end it "rescues EPIPE from the writer" do expect(writer).to receive(:write).and_raise(Errno::EPIPE) expect(service_channel.write("hello")).to eq(nil) end it "forwards #read to the reader" do expect(reader).to receive(:read).and_return("hello") expect(service_channel.read).to eq("hello") end end
Version data entries
18 entries across 18 versions & 1 rubygems