Sha256: f3be7ee8ceb97b78cf15157b8e029f85c2341cd1b8252a37c3c145c5190fe111

Contents?: true

Size: 633 Bytes

Versions: 39

Compression:

Stored size: 633 Bytes

Contents

require 'spec_helper'

describe "#upload_file" do
  it "should upload a multipart_file", :real_only do
    requests = []
    canary = lambda { |env| requests << Rack::Request.new(env); [200, {}, []] }
    client = Ey::Core::Client.new(adapter: [:rack, canary], token: "blah")

    begin
      file = Tempfile.new('foo')
      file.write("bar")
      file.close

      client.upload_file(:file => file.path)
    ensure
      file.close
      file.unlink   # deletes the temp file
    end

    request = requests.first

    expect(request.content_type).to eq("multipart/form-data")
    expect(request.body.read).to eq("bar")
  end
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
ey-core-3.6.0.autoscaling1 spec/requests/upload_file_spec.rb
ey-core-3.6.4 spec/requests/upload_file_spec.rb
ey-core-3.6.3 spec/requests/upload_file_spec.rb
ey-core-3.6.1 spec/requests/upload_file_spec.rb
groove-ey-core-3.6.3 spec/requests/upload_file_spec.rb
groove-ey-core-3.6.2 spec/requests/upload_file_spec.rb
groove-ey-core-3.6.1 spec/requests/upload_file_spec.rb
ey-core-3.5.0 spec/requests/upload_file_spec.rb
ey-core-3.4.4 spec/requests/upload_file_spec.rb
ey-core-3.4.2 spec/requests/upload_file_spec.rb
ey-core-3.4.1 spec/requests/upload_file_spec.rb
ey-core-3.4.0 spec/requests/upload_file_spec.rb
ey-core-3.3.1 spec/requests/upload_file_spec.rb
ey-core-3.3.0 spec/requests/upload_file_spec.rb
ey-core-3.2.6 spec/requests/upload_file_spec.rb
ey-core-3.2.5 spec/requests/upload_file_spec.rb
ey-core-3.2.4 spec/requests/upload_file_spec.rb
ey-core-3.2.3 spec/requests/upload_file_spec.rb
ey-core-3.2.2 spec/requests/upload_file_spec.rb
ey-core-3.2.1 spec/requests/upload_file_spec.rb