Sha256: 2a5489837eaa2a3cf0085a0c8c53b21e519fff92beb688b7d8c7aa24c3ea134c

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

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

module Troo
  module Commands
    describe Status do
      let(:described_class) { Status }
      let(:klass) { Troo::Board }
      let(:default) { true }

      before { API::Client.stubs(:perform) }

      describe '.dispatch' do
        subject { described_class.dispatch(klass) }

        before { @board = Fabricate(:board, default: default) }
        after  { database_cleanup }

        context 'when a default is set' do
          it 'returns a polite message' do
            subject.must_match(/1 board found/)
          end

          it 'returns the name of the resource' do
            subject.must_match(/My Test Board/)
          end
        end

        context 'when no default is set' do
          let(:default) { false }

          context 'and the resource exists' do
            it 'returns a polite message' do
              subject.must_match(/No default board set/)
            end
          end

          context 'and no resources exist' do
            before { klass.stubs(:count).returns(0) }

            it 'returns a polite message' do
              subject.must_match(/No boards found/)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
troo-0.0.11 test/lib/troo/cli/commands/status_test.rb
troo-0.0.10 test/lib/troo/cli/commands/status_test.rb
troo-0.0.9 test/lib/troo/cli/commands/status_test.rb