Sha256: f2931ab230e216d507215851bbd90f3a50feeec9faa02cc6c1e2d9f51ad42895
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true require 'spec_helper' require 'slack_messaging' describe SlackMessaging::HighlineCli do let(:response) { double(:response, readline: true, to_i: 3) } let(:highline_client) { double(:highline_cli, ask: response) } 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 |
---|---|
slack_messaging-3.0.0 | spec/slack_messaging/highline_cli_spec.rb |