Sha256: 1d2c0153e8e4434db876fdc0b064d69b117dcfce36ffd604b47718e03de5e58f

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe 'Refined Item Store' do
  describe 'Adding Items' do
    it 'should be able to add items to the store' do
      item = {}
      adapter = double(Jamnagar::Adapters::PersistentStoreAdapter)
      expect(adapter).to receive(:insert).with(item)
      sut = Jamnagar::Storage::RefinedItemStore.new(adapter)
      sut.insert(item)
    end
  end

  describe 'Querying for Duplicates' do
    it 'should tell the adapter to find the duplicates' do
      adapter = double(Jamnagar::Adapters::PersistentStoreAdapter)
      sut = Jamnagar::Storage::RefinedItemStore.new(adapter)
      expect(adapter).to receive(:find).with(1, "http://example.com")
      sut.duplicates_of(1, "http://example.com")
    end
    it 'should return any results' do
      items = [Jamnagar::Materials::Twitter::Item.new, Jamnagar::Materials::Twitter::Item.new]
      adapter = double(Jamnagar::Adapters::MongoAdapter)
      allow(adapter).to receive(:find).and_return(items)
      sut = Jamnagar::Storage::RefinedItemStore.new(adapter)
      expect(sut.duplicates_of(1,"http://example.com")).to eq items
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jamnagar-1.3.9.1 spec/refined_item_store_spec.rb
jamnagar-1.3.9 spec/refined_item_store_spec.rb