Sha256: 0ca12327cd463c9851ec050edcfc3f508ac05db59ed1f4cfefd11bbc0e58260c

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe FutureWebItem do
  it 'errors if not given all required arguments' do
    expect {
      described_class.new(url: 'https://www.wetransfer.com', local_identifier: '321235151')
    }.to raise_error(/missing keyword: title/)

    expect {
      described_class.new(title: 'wetransfer.com')
    }.to raise_error(/missing keyword: url/)
  end

  it 'succeeds if given all arguments' do
    future_web_item = described_class.new(url: 'https://www.wetransfer.com', title: 'wetransfer.com', local_identifier: '321235151')
    expect(future_web_item).to be_kind_of(FutureWebItem)
  end

  it 'succeeds if not passed a local_identifier' do
    future_web_item = described_class.new(url: 'https://www.wetransfer.com', title: 'wetransfer.com')
    expect(future_web_item).to be_kind_of(FutureWebItem)
  end

  it 'generates a local_identifier' do
    future_web_item = described_class.new(url: 'https://www.wetransfer.com', title: 'wetransfer.com')
    expect(future_web_item).to be_kind_of(FutureWebItem)
    expect(future_web_item.local_identifier).to_not be nil
    expect(future_web_item.local_identifier).to be_kind_of(String)
  end

  it 'creates params properly' do
    future_web_item = described_class.new(url: 'https://www.wetransfer.com', title: 'wetransfer.com')
    item_as_params = future_web_item.to_item_request_params
    expect(item_as_params[:content_identifier]).to eq('web_content')
    expect(item_as_params[:local_identifier]).to be_kind_of(String)
    expect(item_as_params[:url]).to eq('https://www.wetransfer.com')
    expect(item_as_params[:meta][:title]).to eq('wetransfer.com')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wetransfer-0.4.4 spec/we_transfer_client/future_web_item_spec.rb
wetransfer-0.4.3 spec/we_transfer_client/future_web_item_spec.rb
wetransfer-0.4.2 spec/we_transfer_client/future_web_item_spec.rb
wetransfer-0.4.1 spec/we_transfer_client/future_web_item_spec.rb
wetransfer-0.4.0 spec/we_transfer_client/future_web_item_spec.rb