Sha256: 1e44456ae4b7ec2055228a7dd3883584a9b2424ca31ca25b612cf03c13dc6c57
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' require 'stringio' describe Kcl::IOHandler do let(:input) { StringIO.new } let(:output) { StringIO.new } let(:error) { StringIO.new } subject { Kcl::IOHandler.new input, output, error } describe '#write_action' do let(:action) { { action: 'test', value: 123 } } before { subject.write_action action } it { expect(output.string).to eq "\n#{action.to_json}\n" } it { expect(input.string).to eq '' } it { expect(error.string).to eq '' } end describe '#write_error' do let(:message) { 'Some error' } before { subject.write_error message } it { expect(error.string).to eq "#{message}\n" } it { expect(input.string).to eq '' } it { expect(output.string).to eq '' } end describe '#read_action' do context 'With empty line input' do it { expect(subject.read_action).to be_nil } end context 'With valid action input' do let(:action) { { 'action' => 'test', 'value' => 1 } } before { input.string = action.to_json } it { expect(subject.read_action).to eq action } end context 'With invalid action input' do before { input.string = 'dummy' } it { expect { subject.read_action }.to raise_error Kcl::IOHandler::ReadError } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
amazon-kinesis-client-ruby-0.0.3 | spec/io_handler_spec.rb |
amazon-kinesis-client-ruby-0.0.1 | spec/io_handler_spec.rb |