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