Sha256: 68fb7d39adf1500ea869de2dea41eaf7039c127bfa9aa08a3211af7c871e39af

Contents?: true

Size: 1010 Bytes

Versions: 3

Compression:

Stored size: 1010 Bytes

Contents

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

module Troo
  module CLI
    describe ThorFixes do
      let(:described_class) { ThorFixes }
      let(:command)         { stub(usage: 'usage') }
      let(:namespace)       {}
      let(:subcommand)      {}
      let(:package_name)    {}

      describe '.banner' do
        before do
          described_class
            .instance_variable_set('@package_name', package_name)
        end

        subject do
          described_class.banner(command, namespace, subcommand)
        end

        it { subject.must_be_instance_of(String) }

        context 'when executing a subcommand' do
          let(:package_name) { 'show' }

          it 'package_name has a leading space' do
            subject.must_match(/show usage/)
          end
        end

        context 'when executing a top-level command' do
          it 'package_name does not have a leading space' do
            subject.must_match(/\s{1}usage/)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troo-0.0.15 test/lib/troo/cli/thor_fixes_test.rb
troo-0.0.14 test/lib/troo/cli/thor_fixes_test.rb
troo-0.0.13 test/lib/troo/cli/thor_fixes_test.rb