Sha256: 17f4156b0447c025fae36a88a88acb62bdc90b1fd1e7f84fb18d2917d24e8637

Contents?: true

Size: 1004 Bytes

Versions: 2

Compression:

Stored size: 1004 Bytes

Contents

require 'spec_helper'

describe FutureFile do
  let(:params) { { name: 'yes', io: File.open(__FILE__, 'rb') } }

  describe '#initilizer' do
    it 'needs an :io keyword arg' do
      params.delete(:io)

      expect {
        described_class.new(params)
      }.to raise_error(ArgumentError, /io/)
    end

    it 'needs a :name keyword arg' do
      params.delete(:name)

      expect {
        described_class.new(params)
      }.to raise_error(ArgumentError, /name/)
    end

    it 'succeeds if given all arguments' do
      described_class.new(params)
    end
  end

  describe '#to_request_params' do
    it 'returns a hash with name and size' do
      as_params = described_class.new(params).to_request_params

      expect(as_params[:name]).to eq('yes')
      expect(as_params[:size]).to be_kind_of(Integer)
    end
  end

  describe 'getters' do
    let(:subject) { described_class.new(params) }

    it '#name' do
      subject.name
    end

    it '#io' do
      subject.io
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wetransfer-0.9.0.beta1 spec/we_transfer_client/future_file_spec.rb
wetransfer-0.9.0.beta spec/we_transfer_client/future_file_spec.rb