Skip to content

Commit 14cae5b

Browse files
authored
Merge pull request #3 from couchbase-examples/update-airline-tests
chore: Fix broken API endpoint in airlines_spec.rb
2 parents 2e8d42b + 45b6bb3 commit 14cae5b

File tree

2 files changed

+59
-38
lines changed

2 files changed

+59
-38
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
# Keep bundler dependencies up to date
4+
- package-ecosystem: "bundler"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"

test/integration/airlines_spec.rb

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
end
179179

180180
it 'returns a list of airlines for a given country' do
181-
get '/api/v1/airlines/list', params: { country: country, limit: limit, offset: offset }
181+
get '/api/v1/airlines/list', params: { country:, limit:, offset: }
182182

183183
expect(response).to have_http_status(:ok)
184184
expect(response.content_type).to eq('application/json; charset=utf-8')
@@ -187,11 +187,18 @@
187187
end
188188

189189
describe 'GET /api/v1/airlines/to-airport' do
190-
let(:destination_airport_code) { 'MRS' }
190+
let(:destination_airport_code) { 'JFK' }
191191
let(:limit) { '10' }
192192
let(:offset) { '0' }
193193
let(:expected_airlines) do
194194
[
195+
{
196+
'callsign' => 'SPEEDBIRD',
197+
'country' => 'United Kingdom',
198+
'iata' => 'BA',
199+
'icao' => 'BAW',
200+
'name' => 'British Airways'
201+
},
195202
{
196203
'callsign' => 'AIRFRANS',
197204
'country' => 'France',
@@ -200,61 +207,68 @@
200207
'name' => 'Air France'
201208
},
202209
{
203-
'callsign' => 'SPEEDBIRD',
204-
'country' => 'United Kingdom',
205-
'iata' => 'BA',
206-
'icao' => 'BAW',
207-
'name' => 'British Airways'
210+
'callsign' => 'DELTA',
211+
'country' => 'United States',
212+
'iata' => 'DL',
213+
'icao' => 'DAL',
214+
'name' => 'Delta Air Lines'
208215
},
209216
{
210-
'callsign' => 'AIRLINAIR',
211-
'country' => 'France',
212-
'iata' => 'A5',
213-
'icao' => 'RLA',
214-
'name' => 'Airlinair'
217+
'callsign' => 'AMERICAN',
218+
'country' => 'United States',
219+
'iata' => 'AA',
220+
'icao' => 'AAL',
221+
'name' => 'American Airlines'
215222
},
216223
{
217-
'callsign' => 'STARWAY',
218-
'country' => 'France',
219-
'iata' => 'SE',
220-
'icao' => 'SEU',
221-
'name' => 'XL Airways France'
224+
'callsign' => 'HAWAIIAN',
225+
'country' => 'United States',
226+
'iata' => 'HA',
227+
'icao' => 'HAL',
228+
'name' => 'Hawaiian Airlines'
222229
},
223230
{
224-
'callsign' => 'TWINJET',
225-
'country' => 'France',
226-
'iata' => 'T7',
227-
'icao' => 'TJT',
228-
'name' => 'Twin Jet'
231+
'callsign' => 'JETBLUE',
232+
'country' => 'United States',
233+
'iata' => 'B6',
234+
'icao' => 'JBU',
235+
'name' => 'JetBlue Airways'
229236
},
230237
{
231-
'callsign' => 'EASY',
232-
'country' => 'United Kingdom',
233-
'iata' => 'U2',
234-
'icao' => 'EZY',
235-
'name' => 'easyJet'
238+
'callsign' => 'FLAGSHIP',
239+
'country' => 'United States',
240+
'iata' => '9E',
241+
'icao' => 'FLG',
242+
'name' => 'Pinnacle Airlines'
236243
},
237244
{
238-
'callsign' => 'AMERICAN',
245+
'callsign' => 'SUN COUNTRY',
239246
'country' => 'United States',
240-
'iata' => 'AA',
241-
'icao' => 'AAL',
242-
'name' => 'American Airlines'
247+
'iata' => 'SY',
248+
'icao' => 'SCX',
249+
'name' => 'Sun Country Airlines'
243250
},
244251
{
245-
'callsign' => 'CORSICA',
246-
'country' => 'France',
247-
'iata' => 'XK',
248-
'icao' => 'CCM',
249-
'name' => 'Corse-Mediterranee'
252+
'callsign' => 'UNITED',
253+
'country' => 'United States',
254+
'iata' => 'UA',
255+
'icao' => 'UAL',
256+
'name' => 'United Airlines'
257+
},
258+
{
259+
'callsign' => 'U S AIR',
260+
'country' => 'United States',
261+
'iata' => 'US',
262+
'icao' => 'USA',
263+
'name' => 'US Airways'
250264
}
251265
]
252266
end
253267

254268
context 'when destinationAirportCode is provided' do
255269
it 'returns a list of airlines flying to the destination airport' do
256270
get '/api/v1/airlines/to-airport',
257-
params: { destinationAirportCode: destination_airport_code, limit: limit, offset: offset }
271+
params: { destinationAirportCode: destination_airport_code, limit:, offset: }
258272

259273
expect(response).to have_http_status(:ok)
260274
expect(response.content_type).to eq('application/json; charset=utf-8')
@@ -264,7 +278,7 @@
264278

265279
context 'when destinationAirportCode is not provided' do
266280
it 'returns a bad request error' do
267-
get '/api/v1/airlines/to-airport', params: { limit: limit, offset: offset }
281+
get '/api/v1/airlines/to-airport', params: { limit:, offset: }
268282

269283
expect(response).to have_http_status(:bad_request)
270284
expect(JSON.parse(response.body)).to eq({ 'message' => 'Destination airport code is required' })

0 commit comments

Comments
 (0)