Sha256: 600b6edd672fc2fafca86cb61542be0941946edbefc7d195f91057a519bec04f

Contents?: true

Size: 840 Bytes

Versions: 1

Compression:

Stored size: 840 Bytes

Contents

require 'spec_helper'

RSpec.describe VirusScanService::Courier do
  include RequestResponseMocks

  let(:courier) {
    described_class
      .new(token: 'abcdefg', host: 'http://thisisa.test')
      .tap { |c| c.logger = Struct::NullLogger.new }
  }

  before do
    server_response_list do
      '[{"id":"123","scan_result":"","file_url":"http://thisis.test/download/file.png"}]'
    end

    server_request_put(id: 123, status: 'Clean') do
      '{"id":"123","scan_result":"Clean","file_url":"http://thisis.test/download/file.png"}'
    end
  end

  it do
    expect(DummyViruscheckRunner)
      .to receive(:new)
      .with('http://thisis.test/download/file.png')
      .once
      .and_call_original

    courier.call do |file_url|
      casp = DummyViruscheckRunner.new(file_url)
      casp.call
      casp.result
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
virus_scan_service-0.0.8 spec/courier_spec.rb