Sha256: 05ffd7343e3e8c7d9ef7cd9c12f51fffd7541e10fe3f58d1af5cba26bd29134b
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
require_relative '../../../../test_helper' module Troo module Commands module Show describe Card do let(:described_class) { Card } let(:type) { :card } let(:id) { '1' } let(:default) { false } let(:resource) {} let(:presenter) { stub } before do @card = Fabricate.build(:card, default: default) Retrieval::Card.stubs(:retrieve).returns(resource) Presenters::Card.stubs(:new).returns(presenter) presenter.stubs(:show).returns(@card.name) end after { database_cleanup } describe '.dispatch' do subject { described_class.dispatch(type, id) } context 'when a resource ID is provided' do context 'and the resource exists' do let(:resource) { @card } it 'presents the cards' do subject.must_match(/#{@card.name}/) end end context 'but the resource does not exist' do it 'returns a polite message' do subject.must_match(/Card cannot be found/) end end end context 'when a resource ID is not provided' do let(:id) {} context 'and a default resource is set' do let(:default) { true } let(:resource) { @card } it 'presents the cards' do subject.must_match(/#{@card.name}/) end end context 'and a default resource is not set' do it 'returns a polite message' do subject.must_match(/to set a default card first/) 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/show/card_test.rb |