Sha256: a7ac5c3118a431a64db92875841fa0d0ab5514df1c25c6263b4091b26fdfc655

Contents?: true

Size: 986 Bytes

Versions: 2

Compression:

Stored size: 986 Bytes

Contents

require 'spec_helper'

describe Jamnagar::Refiners::SourceDetail do
  it 'accepts a store' do
    store = {}
    Jamnagar::Refiners::SourceDetail.new(store: store)
  end
  it 'should look for the user in the source store' do
    @item  = Jamnagar::Materials::Twitter::Item.new({"final_url_host" => "example.com"})
    @store = double(Jamnagar::Storage::SourceStore)
    @sut   = Jamnagar::Refiners::SourceDetail.new(store: @store)

    expect(@store).to receive(:find_source).with(@item, {"id" => "example.com"})
    @sut.refine(@item)
  end
  it 'should return the details of the source' do
    @item  = Jamnagar::Materials::Twitter::Item.new({"final_url_host" => "example.org"})
    @store = double(Jamnagar::Storage::SourceStore)
    @sut   = Jamnagar::Refiners::SourceDetail.new(store: @store)
    allow(@store).to receive(:find_source).and_return({"_id" => 999})

    expect(@sut.refine(@item).to_h).to eq({"final_url_host" => "example.org", "source" => {"_id" => 999}})
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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