Sha256: ba6f93eda32d2b2786c95fe645b81b7c5e32714e2db0ad7320dc3d2e3e15ad04

Contents?: true

Size: 1.91 KB

Versions: 4

Compression:

Stored size: 1.91 KB

Contents

require 'spec_helper'

describe GetYourGuide::Models::Destination do
  subject(:destination) {
    GetYourGuide::Models::Destination.new(
      provider_id: 1,
      name: 'Name',
      country: 'Country',
      unlocode: 'FR',
      iata: 'EUR',
      destination_type: 'Destination Type'
    )
  }
  subject(:destination_with_nil_attributes) {
    GetYourGuide::Models::Destination.new(
      provider_id: 1,
      name: 'Name',
      country: 'Country',
      unlocode: nil,
      iata: nil,
      destination_type: 'Destination Type'
    )
  }

  it 'should be a GetYourGuide::Models::Destination object' do
    expect(destination).to be_an_instance_of(GetYourGuide::Models::Destination)
  end

  it 'should have a provider_id' do
    expect(destination.provider_id).to eq(1)
    expect(destination.provider_id).to be_an_instance_of(Fixnum)
  end

  it 'should have a name' do
    expect(destination.name).to eq('Name')
    expect(destination.name).to be_an_instance_of(String)
  end

  it 'should have a country' do
    expect(destination.country).to eq('Country')
    expect(destination.country).to be_an_instance_of(String)
  end

  context 'WITH iata and un/locode' do
    it 'should have a not null iata' do
      expect(destination.iata).to eq('EUR')
      expect(destination.iata).to be_an_instance_of(String)
    end

    it 'should have a not null un/locode' do
      expect(destination.unlocode).to eq('FR')
      expect(destination.unlocode).to be_an_instance_of(String)
    end
  end

  context 'WITHOUT iata and un/locode' do
    it 'should have a null iata' do
      expect(destination_with_nil_attributes.iata).to be_nil
    end

    it 'should have a null un/locode' do
      expect(destination_with_nil_attributes.unlocode).to be_nil
    end
  end

  it 'should have a destination_type' do
    expect(destination.destination_type).to eq('Destination Type')
    expect(destination.destination_type).to be_an_instance_of(String)
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
slack-rtm-api-0.1.0 spec/getyourguide/models/destination_spec.rb
slack-rtm-api-0.0.1 spec/getyourguide/models/destination_spec.rb
getyourguide-1.0.0 spec/getyourguide/models/destination_spec.rb
getyourguide-0.2.1 spec/getyourguide/models/destination_spec.rb