Sha256: ed88a07b409e3ebb1e41fe201c7d7813f11b54a522220cdd79671658cb52f80c

Contents?: true

Size: 723 Bytes

Versions: 10

Compression:

Stored size: 723 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 = 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

10 entries across 10 versions & 2 rubygems

Version Path
clamby-1.6.9 spec/spec_helper.rb
clambytoo-1.0.0 spec/spec_helper.rb
clamby-1.6.8 spec/spec_helper.rb
clamby-1.6.6 spec/spec_helper.rb
clamby-1.6.5 spec/spec_helper.rb
clamby-1.6.2 spec/spec_helper.rb
clamby-1.6.1 spec/spec_helper.rb
clamby-1.6.0 spec/spec_helper.rb
clamby-1.5.1 spec/spec_helper.rb
clamby-1.5.0 spec/spec_helper.rb