Sha256: c9640d217f6cc7b63d344c5b57a9ef6fa6b5fb3141d73dba0f7921c865d129a6
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true require 'spec_helper' require 'git_helper' describe GitHelper::HighlineCli do let(:response) { double(:response, readline: true, to_i: 3) } let(:highline_client) { double(:highline_cli, ask: response) } subject { GitHelper::HighlineCli.new } before do allow(HighLine).to receive(:new).and_return(highline_client) end describe '#ask' do it 'should ask the highline client ask' do expect(highline_client).to receive(:ask) subject.ask(Faker::Lorem.sentence) end it 'should return a string' do expect(subject.ask(Faker::Lorem.sentence)).to be_a(String) end end describe '#ask_yes_no' do it 'should ask the highline client ask' do expect(highline_client).to receive(:ask) subject.ask_yes_no(Faker::Lorem.sentence) end it 'should return a boolean' do expect(subject.ask_yes_no(Faker::Lorem.sentence)).to be_falsey end it 'should return true if we say yes' do allow(response).to receive(:to_s).and_return('y') expect(subject.ask_yes_no(Faker::Lorem.sentence)).to be_truthy end end describe '#ask_options' do it 'should ask the highline client ask' do expect(highline_client).to receive(:ask) subject.ask_options(Faker::Lorem.sentence, %w[one two three]) end it 'should return a string from the options' do expect(subject.ask_options(Faker::Lorem.sentence, %w[one two three])).to be_a(String) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git_helper-3.3.2 | spec/git_helper/highline_cli_spec.rb |