Sha256: c705db4bae16001ce433dddc530755a99e0a7e5f9869fbc9ff83a3c2c4db9f59
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
require_relative '../../../../test_helper' module Troo module Commands module Refresh describe Card do let(:described_class) { Card } let(:id) { '1' } let(:resource) {} let(:retrieved) {} before do @card = Fabricate.build(:card) Retrieval::Card.stubs(:retrieve).returns(resource) External::Card.stubs(:fetch).returns(retrieved) end after { database_cleanup } describe '.dispatch' do subject { described_class.dispatch(id) } context 'when the resource exists' do let(:resource) { @card } let(:retrieved) { [@card] } 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) { [@card, @card] } it 'returns a polite message' do subject.must_match(/Multiple/) end end end context 'when the resource does not exist' do let(:resource) {} it 'returns a polite message' do subject.must_match(/Card cannot be found/) end end context 'and the default resource does not exist' do let(:id) {} let(:resource) {} it 'returns a polite message' do subject.must_match(/Default card cannot be found/) 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/refresh/card_test.rb |