Sha256: 74c0b0a573bc83152e0a25b2615cf8b456ba722c4bc2da643d9eed0fc9050970
Contents?: true
Size: 1.6 KB
Versions: 3
Compression:
Stored size: 1.6 KB
Contents
require_relative '../../../../test_helper' module Troo module Commands describe Refresh do let(:described_class) { Refresh } let(:id) {} let(:resource) {} let(:retrieved) {} let(:klass) { stub(type: :resource_type, remote: stub) } before do API::Client.stubs(:perform) @board = Fabricate.build(:board) Retrieval::Local.stubs(:retrieve).returns(resource) Retrieval::Remote.stubs(:fetch).returns(retrieved) end after { database_cleanup } describe '.dispatch' do subject { described_class.dispatch(klass, id) } it { subject.must_be_instance_of(String) } context 'when the resource exists' do let(:resource) { @board } let(:retrieved) { [@board] } context 'and the resource is refreshed' do it 'returns a polite message' do subject.must_match(/refreshed/) end end context 'and multiple resources are refreshed' do let(:retrieved) { [@board, @board] } it 'returns a polite message' do subject.must_match(/Multiple/) end end end context 'when the resource does not exist' do it 'returns a polite message' do subject.must_match(/cannot be found/) end end context 'and the default resource does not exist' do it 'returns a polite message' do subject.must_match(/to set a default/) 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/commands/refresh_test.rb |
troo-0.0.14 | test/lib/troo/cli/commands/refresh_test.rb |
troo-0.0.13 | test/lib/troo/cli/commands/refresh_test.rb |