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