Sha256: b093e2feb19dc4975c44e4e769c7bb103f6831dd8a0f184b118d2a16a1188f53

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

require 'bundler/setup'
Bundler.setup

require 'open-uri'
require 'tempfile'

require 'clamby' # and any other gems you need

RSpec.configure do |config|
  config.mock_with :rspec do |mocks|
    # so that Command can keep doing what it always does.
    mocks.verify_partial_doubles = true
  end

  def download(url)
    file = URI.open(url)
    file.is_a?(StringIO) ? to_tempfile(file) : file
  end

  # OpenURI returns either Tempfile or StringIO depending of the size of
  # the response. We want to unify this and always return Tempfile.
  def to_tempfile(io)
    tempfile = Tempfile.new('tmp')
    tempfile.binmode
    ::OpenURI::Meta.init(tempfile, io)
    tempfile << io.string
    tempfile.rewind
    tempfile
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clamby-1.6.11 spec/spec_helper.rb
clamby-1.6.10 spec/spec_helper.rb