Sha256: 96736aa82b6ba656e128173d717d70b93989c03fd8baab6e71042dbfba6f565b

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

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

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

        describe '.dispatch' do
          subject { described_class.dispatch }

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

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

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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 test/lib/troo/commands/status/card_test.rb