Sha256: 3233eca9828b9036fdc7b681f06c64545ebca7afe63d9059c4b336a20d2f996d

Contents?: true

Size: 1.41 KB

Versions: 29

Compression:

Stored size: 1.41 KB

Contents

require 'spec_helper'
require 'quick_travel/product_type'
require 'quick_travel/resource_category'

describe QuickTravel::ProductType do
  context '#all' do
    subject(:all) do
      VCR.use_cassette('product_type_all') { QuickTravel::ProductType.all }
    end

    its(:class) { should == Array }
    its(:length) { should == 9 }

    context 'first element' do
      subject(:ferry) { all.first }
      its(:class) { should == QuickTravel::ProductType }
      its(:name)  { should == 'Ferry' }

      context '#resource_category_ids' do
        subject {
          VCR.use_cassette 'product_type_resource_categories' do
            ferry.resource_categories
          end
        }
        its(:size) { should eq 0 }
      end

      context '#routes' do
        subject {
          VCR.use_cassette 'product_type_routes' do
            ferry.routes
          end
        }
        its(:size) { should eq 2 }
        its('first.name') { should eq 'To Kangaroo Island' }
      end
    end

    context 'tickets product type' do
      subject(:tickets) {
        all.detect { |product_type| product_type.name == 'Ticket' }
      }

      context '#resource_category_ids' do
        subject {
          VCR.use_cassette 'product_type_resource_categories_tickets' do
            tickets.resource_categories
          end
        }
        its(:size) { should eq 2 }
        its('first.name') { should eq 'Common' }
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
quicktravel_client-4.7.0 spec/product_type_spec.rb
quicktravel_client-4.6.0 spec/product_type_spec.rb
quicktravel_client-4.5.0 spec/product_type_spec.rb
quicktravel_client-4.4.0 spec/product_type_spec.rb
quicktravel_client-4.3.2 spec/product_type_spec.rb
quicktravel_client-4.3.1 spec/product_type_spec.rb
quicktravel_client-4.3.0 spec/product_type_spec.rb
quicktravel_client-4.2.0 spec/product_type_spec.rb
quicktravel_client-4.1.0 spec/product_type_spec.rb
quicktravel_client-4.0.0 spec/product_type_spec.rb
quicktravel_client-3.9.0 spec/product_type_spec.rb
quicktravel_client-3.8.1 spec/product_type_spec.rb
quicktravel_client-3.8.0 spec/product_type_spec.rb
quicktravel_client-3.7.0 spec/product_type_spec.rb
quicktravel_client-3.6.1 spec/product_type_spec.rb
quicktravel_client-3.6.0 spec/product_type_spec.rb
quicktravel_client-3.5.0 spec/product_type_spec.rb
quicktravel_client-3.4.0 spec/product_type_spec.rb
quicktravel_client-3.3.0 spec/product_type_spec.rb
quicktravel_client-3.2.0 spec/product_type_spec.rb