Sha256: 8ec1a1957107f98fac948c8612b87435b7c2960bdf78ed956ba71b9b9ca83f44

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require_relative '../../../test_helper'

module Troo
  module CLI
    describe Wizard do
      let(:described_class)    { Wizard }
      let(:described_instance) { described_class.new }

      before do
        $stdin.stubs(:gets).returns("y\n")
        Launchy.stubs(:open).returns(true)
        Dir.stubs(:home).returns('./tmp')
      end

      describe '#start' do
        subject { capture_io { described_class.new.start }.join }

        it 'returns a welcome message' do
          subject.must_match(/Welcome/)
        end

        context 'when the user proceeds to step one' do
          it 'returns a thank you message' do
            subject.must_match(/Thank you/)
          end
        end

        context 'when the user proceeds to step two' do
          it 'returns a completion message' do
            subject.must_match(/All done/)
          end
        end

        context 'when the user aborts' do
          before { $stdin.stubs(:gets).returns("n\n") }

          it 'aborts the wizard' do
            proc { subject }.must_raise(Troo::ConfigurationAborted)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.12 test/lib/troo/cli/wizard_test.rb