Sha256: 8676c85fc5e84dcac4e1280969ebd73b3564b67652532b381fc9e188d2a73fb3

Contents?: true

Size: 991 Bytes

Versions: 1

Compression:

Stored size: 991 Bytes

Contents

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

module Troo
  module Commands
    describe RefreshAll do
      def load_mock_trello_response
        json = File.read('./test/support/remotes/board.json')
        hash = Yajl::Parser.parse(json)
        Troo::Remote::Board.new(hash)
      end
      let(:described_class) { RefreshAll }
      let(:resource) { [load_mock_trello_response] }

      before do
        Retrieval::Remote.stubs(:fetch).returns(resource)
      end

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

        context 'when all the resources are refreshed' do
          it 'returns a polite message' do
            subject.must_match(/All local data refreshed/)
          end
        end

        context 'when all the resources are not refreshed' do
          let(:resource) { [] }

          it 'returns a polite message' do
            subject.must_match(/Cannot refresh all local data/)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.9 test/lib/troo/cli/commands/refresh/all_test.rb