Sha256: fcdb16812e031f0b80493f8b238b5f79065d5fb564bdc9792a3ff62bb09d3f5d

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'
require 'uri'
require 'socket'

describe Uploadcare::Api do
  before :each do
    @api = Uploadcare::Api.new(CONFIG)
    @file = File.open(File.join(File.dirname(__FILE__), 'view.png'))
    @file2 = File.open(File.join(File.dirname(__FILE__), 'view2.jpg'))
    @files_ary = [@file, @file2]
  end

  it "it should upload multiple files" do
    expect {files = @api.upload @files_ary}.to_not raise_error
  end

  it "should retunrn an array of files" do
    files = @api.upload @files_ary
    files.should be_kind_of(Array)
  end

  it "each in array should be UC file object" do
    files = @api.upload @files_ary
    files.each do |f|
      f.should be_kind_of(Uploadcare::Api::File)
    end
  end

  it "each in array should have valid UUID" do 
    files = @api.upload @files_ary
    files.each do |f|
      f.should respond_to(:uuid)
      f.uuid.should match(UUID_REGEX)
    end
  end

  it "each in array should load data for uploaded file" do 
    files = @api.upload @files_ary
    files.each do |f|
      f.should respond_to(:load_data)
      expect {f.load_data}.to_not raise_error
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
uploadcare-ruby-1.0.4 spec/uploading_multiple_spec.rb
uploadcare-ruby-1.0.3 spec/uploading_multiple_spec.rb
uploadcare-ruby-1.0.2 spec/uploading_multiple_spec.rb
uploadcare-ruby-1.0.1.rc2 spec/uploading_multiple_spec.rb
uploadcare-ruby-1.0.1.rc1 spec/uploading_multiple_spec.rb