Sha256: c5573510361b397aecf1bdb33f4c5dc329f6a3b9bafd2dd1f2a22762dae15806

Contents?: true

Size: 921 Bytes

Versions: 34

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'

require 'quick_travel/price_quote'

describe QuickTravel::PriceQuote do
  context 'when calculating' do
    let(:reservation_params) {
      { resource_id: 7, quantity: quantity, first_travel_date: '2016-04-15' }
    }
    let(:params) {
      { reservations: [reservation_params] }
    }
    let(:price_quote) {
      VCR.use_cassette('price_quote', record: :new_episodes) {
        QuickTravel::PriceQuote.calculate(params)
      }
    }

    context 'when no rules are applied' do
      let(:quantity) { 2 }

      specify { expect(price_quote.quoted_booking_gross.cents).to eq 6400 }
      specify { expect(price_quote.applied_rules).to be_empty }
    end

    context 'when rules are applied' do
      let(:quantity) { 3 }

      specify { expect(price_quote.quoted_booking_gross.cents).to eq 4800 }
      specify { expect(price_quote.applied_rules).to eq ['Special Offer'] }
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

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