Sha256: c5d00eff6ca0dfcb2605db731ac86d1175ad85a20a34ef9b20469af88ec51859

Contents?: true

Size: 899 Bytes

Versions: 2

Compression:

Stored size: 899 Bytes

Contents

require 'spec_helper'
require 'webrick'

describe 'Fetching data from HTTP remotes' do
  before(:all) do
    log_file ||= StringIO.new
    log = WEBrick::Log.new(log_file)
    options = {
      :Port => 9399,
      :Logger => log,
      :AccessLog => [
          [ log, WEBrick::AccessLog::COMMON_LOG_FORMAT ],
          [ log, WEBrick::AccessLog::REFERER_LOG_FORMAT ]
       ]
    }
    @server = WEBrick::HTTPServer.new(options)
    @server.mount '/', WEBrick::HTTPServlet::FileHandler, fixtures_dir
    trap("INT") { @server.stop }
    @server_thread = Thread.new { @server.start }
  end

  it 'parses the animated PNG over HTTP' do
    file_information = FormatParser.parse_http('http://localhost:9399/PNG/anim.png')
    expect(file_information).not_to be_nil
    expect(file_information.file_nature).to eq(:image)
  end

  after(:all) do
    @server.stop
    @server_thread.join(0.5)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
format_parser-0.1.1 spec/remote_fetching_spec.rb
format_parser-0.1.0 spec/remote_fetching_spec.rb