|
178 | 178 | end |
179 | 179 |
|
180 | 180 | 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: } |
182 | 182 |
|
183 | 183 | expect(response).to have_http_status(:ok) |
184 | 184 | expect(response.content_type).to eq('application/json; charset=utf-8') |
|
187 | 187 | end |
188 | 188 |
|
189 | 189 | describe 'GET /api/v1/airlines/to-airport' do |
190 | | - let(:destination_airport_code) { 'MRS' } |
| 190 | + let(:destination_airport_code) { 'JFK' } |
191 | 191 | let(:limit) { '10' } |
192 | 192 | let(:offset) { '0' } |
193 | 193 | let(:expected_airlines) do |
194 | 194 | [ |
| 195 | + { |
| 196 | + 'callsign' => 'SPEEDBIRD', |
| 197 | + 'country' => 'United Kingdom', |
| 198 | + 'iata' => 'BA', |
| 199 | + 'icao' => 'BAW', |
| 200 | + 'name' => 'British Airways' |
| 201 | + }, |
195 | 202 | { |
196 | 203 | 'callsign' => 'AIRFRANS', |
197 | 204 | 'country' => 'France', |
|
200 | 207 | 'name' => 'Air France' |
201 | 208 | }, |
202 | 209 | { |
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' |
208 | 215 | }, |
209 | 216 | { |
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' |
215 | 222 | }, |
216 | 223 | { |
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' |
222 | 229 | }, |
223 | 230 | { |
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' |
229 | 236 | }, |
230 | 237 | { |
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' |
236 | 243 | }, |
237 | 244 | { |
238 | | - 'callsign' => 'AMERICAN', |
| 245 | + 'callsign' => 'SUN COUNTRY', |
239 | 246 | 'country' => 'United States', |
240 | | - 'iata' => 'AA', |
241 | | - 'icao' => 'AAL', |
242 | | - 'name' => 'American Airlines' |
| 247 | + 'iata' => 'SY', |
| 248 | + 'icao' => 'SCX', |
| 249 | + 'name' => 'Sun Country Airlines' |
243 | 250 | }, |
244 | 251 | { |
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' |
250 | 264 | } |
251 | 265 | ] |
252 | 266 | end |
253 | 267 |
|
254 | 268 | context 'when destinationAirportCode is provided' do |
255 | 269 | it 'returns a list of airlines flying to the destination airport' do |
256 | 270 | get '/api/v1/airlines/to-airport', |
257 | | - params: { destinationAirportCode: destination_airport_code, limit: limit, offset: offset } |
| 271 | + params: { destinationAirportCode: destination_airport_code, limit:, offset: } |
258 | 272 |
|
259 | 273 | expect(response).to have_http_status(:ok) |
260 | 274 | expect(response.content_type).to eq('application/json; charset=utf-8') |
|
264 | 278 |
|
265 | 279 | context 'when destinationAirportCode is not provided' do |
266 | 280 | 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: } |
268 | 282 |
|
269 | 283 | expect(response).to have_http_status(:bad_request) |
270 | 284 | expect(JSON.parse(response.body)).to eq({ 'message' => 'Destination airport code is required' }) |
|
0 commit comments