Sha256: 3143b32d72872f768dbb0fcceeab1651964237b5398988929ea0fffea88a8bc1
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 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) { '526d8e130a14a9d846001d96' } 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.9 | test/lib/troo/retrieval/remote_test.rb |