-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbba68d
commit a413aea
Showing
4 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'quick_travel/adapter' | ||
|
||
module QuickTravel | ||
class PriceQuote < Adapter | ||
self.api_base = '/api/price_quotes' | ||
|
||
def self.calculate(params) | ||
response = post_and_validate("#{api_base}/calculate", params) | ||
new(response) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'spec_helper' | ||
|
||
require 'quick_travel/price_quote' | ||
|
||
describe QuickTravel::PriceQuote do | ||
context 'when calculating' do | ||
let(:reservation_params) { | ||
{ resource_id: 805, quantity: 3, first_travel_date: '2016-04-15'} | ||
} | ||
let(:params) { | ||
{ reservations: [reservation_params] } | ||
} | ||
let(:price_quote) { QuickTravel::PriceQuote.calculate(params) } | ||
|
||
before do | ||
VCR.use_cassette('price_quote') do | ||
price_quote | ||
end | ||
end | ||
|
||
specify { expect(price_quote.quoted_booking_gross.cents).to eq 7680 } | ||
specify { expect(price_quote.applied_rules).to eq ['Special Offer'] } | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.