2017-05-05 11:26:04 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
2018-05-02 12:58:48 -04:00
|
|
|
describe ResolveURLService, type: :service do
|
2017-05-05 11:26:04 -04:00
|
|
|
subject { described_class.new }
|
|
|
|
|
|
|
|
describe '#call' do
|
2019-07-10 12:59:28 -04:00
|
|
|
it 'returns nil when there is no resource url' do
|
|
|
|
url = 'http://example.com/missing-resource'
|
2017-05-05 11:26:04 -04:00
|
|
|
service = double
|
|
|
|
|
2019-07-10 12:59:28 -04:00
|
|
|
allow(FetchResourceService).to receive(:new).and_return service
|
|
|
|
allow(service).to receive(:call).with(url).and_return(nil)
|
2017-05-05 11:26:04 -04:00
|
|
|
|
2019-07-10 12:59:28 -04:00
|
|
|
expect(subject.call(url)).to be_nil
|
2017-05-05 11:26:04 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|