Sha256: 8688a4f154d4b839e107c6881203152e87391e1316a4e871cf64e99c067e8e01

Contents?: true

Size: 1016 Bytes

Versions: 2

Compression:

Stored size: 1016 Bytes

Contents

require 'spec_helper'

describe FutureLink do
  let(:params) { { url: 'http://www.wetransfer.com', title: 'WeTransfer' } }

  describe '#initializer' do
    it 'needs a :url keyword arg' do
      params.delete(:url)
      expect {
        described_class.new(params)
      }.to raise_error(ArgumentError, /url/)
    end

    it 'takes url when no title is given' do
      params.delete(:title)
      expect(described_class.new(params).title).to be(params.fetch(:url))
    end

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

  describe '#to_request_params' do
    it 'creates params properly' do
      as_params = described_class.new(params).to_request_params

      expect(as_params[:url]).to eq('http://www.wetransfer.com')
      expect(as_params[:title]).to be_kind_of(String)
    end
  end

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

    it '#url' do
      subject.url
    end

    it '#title' do
      subject.title
    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_link_spec.rb
wetransfer-0.9.0.beta spec/we_transfer_client/future_link_spec.rb