Sha256: 850f8f73b4e16aa7465deda04771e9834b266c6bcd91656efdbdd17a564c2121
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
require_relative '../../../../test_helper' module Troo describe Retrieval::Comment do let(:described_class) { Retrieval::Comment } before { @comment = Fabricate(:comment) } after { database_cleanup } describe '.all' do subject { described_class.all } it 'retrieves all locally stored comments' do subject.size.must_equal 1 end end describe '.retrieve' do subject { described_class.retrieve(id) } context 'local retrieval by database ID' do let(:id) { @comment.id } it 'returns the correct comment' do subject.text.must_equal('My Test Comment') end end context 'local retrieval by external ID' do let(:id) { '51f9277b2822b8654f0023af' } it 'returns the correct comment' do subject.text.must_equal('My Test Comment') end end context 'when the ID cannot be found' do let(:id) { 'not_found_id' } before { External::Comment.stubs(:fetch).returns([]) } it { subject.must_equal(nil) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.8 | test/lib/troo/models/retrieval/comment_test.rb |