Sha256: 6821573006879148d9ff2e5d5484904bebf52ed1aa4c1cf8203e263c655ef4be

Contents?: true

Size: 706 Bytes

Versions: 4

Compression:

Stored size: 706 Bytes

Contents

require 'ostruct'

describe KumoKeisei::ConsoleJockey do
  describe "#get_confirmation" do
    let(:timeout) { 0.5 }
    subject { described_class }

    context 'no timeout' do

      it 'returns true if user enters yes' do
        allow(STDIN).to receive(:gets) { 'yes' }
        expect(subject.get_confirmation(timeout)).to be true
      end

      it 'returns false if user enters anything other than yes' do
        allow(STDIN).to receive(:gets) { 'aoisdjofa' }
        expect(subject.get_confirmation).to be false
      end
    end

    context 'timeout' do
      it 'returns false if there is a timeout' do
        expect(subject.get_confirmation(timeout)).to be false
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kumo_keisei-5.1.0 spec/lib/kumo_keisei/console_jockey_spec.rb
kumo_keisei-5.0.0 spec/lib/kumo_keisei/console_jockey_spec.rb
kumo_keisei-4.0.7 spec/lib/kumo_keisei/console_jockey_spec.rb
kumo_keisei-4.0.6 spec/lib/kumo_keisei/console_jockey_spec.rb