Sha256: 01eae5f095cee620a249d2a68f1287ab57d6f3ae7aefe31e3c5b78cdbd5560bb
Contents?: true
Size: 1.37 KB
Versions: 3
Compression:
Stored size: 1.37 KB
Contents
require_relative '../../../test_helper' module Troo module Retrieval describe Remote do let(:described_class) { Remote } let(:klass) do mock('klass', all: {}, by_board_id: {}, by_list_id: {}, by_card_id: {}, by_member_id: {}) end let(:external_id) { '20010' } let(:options) { { mode: :board } } let(:resources) { [:not_persisted] } let(:persisted) { [:persisted] } before do klass.stubs(:remote_options).returns({}) API::Client.stubs(:perform).returns(resources) Troo::Persistence::Local.stubs(:with_collection) .returns(persisted) end describe '#fetch' do subject { described_class.fetch(klass, external_id, options) } context 'when no resources were retrieved' do let(:resources) { [] } it { subject.must_equal [] } end context 'when resources were retrieved' do context 'and persistence is allowed' do it { subject.must_equal [:persisted] } end context 'and persistence is not allowed' do let(:options) { { persist: false } } it { subject.must_equal [:not_persisted] } end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.12 | test/lib/troo/retrieval/remote_test.rb |
troo-0.0.11 | test/lib/troo/retrieval/remote_test.rb |
troo-0.0.10 | test/lib/troo/retrieval/remote_test.rb |