|
191 | 191 | end |
192 | 192 | end |
193 | 193 |
|
194 | | - # describe 'GET /api/v1/airports/direct-connections' do |
195 | | - # let(:destination_airport_code) { 'JFK' } |
196 | | - # let(:limit) { 10 } |
197 | | - # let(:offset) { 0 } |
198 | | - # let(:expected_connections) { %w[DEL LHR EZE ATL CUN MEX LAX SAN SEA SFO] } |
199 | | - |
200 | | - # context 'when the destination airport code is provided' do |
201 | | - # it 'returns the direct connections' do |
202 | | - # get '/api/v1/airports/direct-connections', |
203 | | - # params: { destinationAirportCode: destination_airport_code, limit: limit, offset: offset } |
204 | | - |
205 | | - # expect(response).to have_http_status(:ok) |
206 | | - # expect(response.content_type).to eq('application/json; charset=utf-8') |
207 | | - # expect(JSON.parse(response.body)).to eq(expected_connections) |
208 | | - # end |
209 | | - # end |
210 | | - |
211 | | - # context 'when the destination airport code is not provided' do |
212 | | - # it 'returns a bad request error' do |
213 | | - # get '/api/v1/airports/direct-connections' |
214 | | - |
215 | | - # expect(response).to have_http_status(:bad_request) |
216 | | - # expect(JSON.parse(response.body)).to eq({ 'message' => 'Destination airport code is required' }) |
217 | | - # end |
218 | | - # end |
219 | | - # end |
| 194 | + describe 'GET /api/v1/airports/direct-connections' do |
| 195 | + let(:destination_airport_code) { 'JFK' } |
| 196 | + let(:limit) { 10 } |
| 197 | + let(:offset) { 0 } |
| 198 | + let(:expected_connections) { %w[DEL LHR EZE ATL CUN MEX LAX SAN SEA SFO] } |
| 199 | + |
| 200 | + context 'when the destination airport code is provided' do |
| 201 | + it 'returns the direct connections' do |
| 202 | + get '/api/v1/airports/direct-connections', |
| 203 | + params: { destinationAirportCode: destination_airport_code, limit:, offset: } |
| 204 | + |
| 205 | + expect(response).to have_http_status(:ok) |
| 206 | + expect(response.content_type).to eq('application/json; charset=utf-8') |
| 207 | + expect(JSON.parse(response.body)).to eq(expected_connections) |
| 208 | + end |
| 209 | + end |
| 210 | + |
| 211 | + context 'when the destination airport code is not provided' do |
| 212 | + it 'returns a bad request error' do |
| 213 | + get '/api/v1/airports/direct-connections' |
| 214 | + |
| 215 | + expect(response).to have_http_status(:bad_request) |
| 216 | + expect(JSON.parse(response.body)).to eq({ 'message' => 'Destination airport code is required' }) |
| 217 | + end |
| 218 | + end |
| 219 | + end |
220 | 220 | end |
0 commit comments