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