spacex 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +4 -4
- data/CHANGELOG.md +16 -1
- data/README.md +111 -11
- data/lib/spacex.rb +9 -6
- data/lib/spacex/base_request.rb +1 -1
- data/lib/spacex/endpoint.rb +1 -1
- data/lib/spacex/history.rb +7 -0
- data/lib/spacex/launches.rb +12 -4
- data/lib/spacex/payloads.rb +7 -0
- data/lib/spacex/version.rb +1 -2
- data/spec/fixtures/spacex/history/info.yml +62 -0
- data/spec/fixtures/spacex/history/info/4.yml +62 -0
- data/spec/fixtures/spacex/launches/68.yml +69 -0
- data/spec/fixtures/spacex/launches/all.yml +8 -8
- data/spec/fixtures/spacex/launches/info.yml +62 -0
- data/spec/fixtures/spacex/launches/past.yml +62 -0
- data/spec/fixtures/spacex/launches/upcoming.yml +64 -0
- data/spec/fixtures/spacex/payloads/RatSat.yml +62 -0
- data/spec/fixtures/spacex/payloads/info.yml +62 -0
- data/spec/spacex/endpoint_spec.rb +9 -0
- data/spec/spacex/history_spec.rb +50 -0
- data/spec/spacex/launches_spec.rb +377 -2
- data/spec/spacex/payloads_spec.rb +62 -0
- metadata +26 -2
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SPACEX::History do
|
4
|
+
context '#info', vcr: { cassette_name: 'history/info' } do
|
5
|
+
subject do
|
6
|
+
SPACEX::History.info
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'returns all historical events when no id is passed' do
|
10
|
+
first_subject = subject.first
|
11
|
+
expect(first_subject.id).to eq 1
|
12
|
+
expect(first_subject.title).to eq 'Falcon 1 Makes History'
|
13
|
+
expect(first_subject.event_date_utc).to eq '2008-09-28T23:15:00Z'
|
14
|
+
expect(first_subject.event_date_unix).to eq 1_222_643_700
|
15
|
+
expect(first_subject.flight_number).to eq 4
|
16
|
+
expect(first_subject.details).to eq(
|
17
|
+
'Falcon 1 becomes the first privately '\
|
18
|
+
'developed liquid fuel rocket to reach Earth orbit.'
|
19
|
+
)
|
20
|
+
expect(first_subject.links).to eq(
|
21
|
+
'reddit' => nil,
|
22
|
+
'article' => 'http://www.spacex.com/news/2013/02/11/flight-4-launch-update-0',
|
23
|
+
'wikipedia' => 'https://en.wikipedia.org/wiki/Falcon_1'
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context '#info(4)', vcr: { cassette_name: 'history/info/4' } do
|
29
|
+
subject do
|
30
|
+
SPACEX::History.info(4)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'returns Historical event info for event id 4' do
|
34
|
+
expect(subject.id).to eq 4
|
35
|
+
expect(subject.title).to eq 'Falcon 9 First Flight'
|
36
|
+
expect(subject.event_date_utc).to eq '2010-06-04T18:45:00Z'
|
37
|
+
expect(subject.event_date_unix).to eq 1_275_677_100
|
38
|
+
expect(subject.flight_number).to eq 6
|
39
|
+
expect(subject.details).to eq(
|
40
|
+
'Met 100% of mission objectives on the first flight!'
|
41
|
+
)
|
42
|
+
expect(subject.links).to eq(
|
43
|
+
'reddit' => nil,
|
44
|
+
'article' => 'http://www.bbc.com/news/10209704',
|
45
|
+
'wikipedia' =>
|
46
|
+
'https://en.wikipedia.org/wiki/Dragon_Spacecraft_Qualification_Unit'
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -73,7 +73,7 @@ describe SPACEX::Launches do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
context '#info', vcr: { cassette_name: 'launches' } do
|
76
|
+
context '#info', vcr: { cassette_name: 'launches/info' } do
|
77
77
|
subject do
|
78
78
|
SPACEX::Launches.info
|
79
79
|
end
|
@@ -151,7 +151,7 @@ describe SPACEX::Launches do
|
|
151
151
|
end
|
152
152
|
|
153
153
|
it 'returns the subject.last scheduled launch' do
|
154
|
-
expect(subject.last.flight_number).to eq
|
154
|
+
expect(subject.last.flight_number).to eq 91
|
155
155
|
expect(subject.last.mission_name).to eq 'GPS IIIA-3'
|
156
156
|
expect(subject.last.launch_year).to eq '2019'
|
157
157
|
expect(subject.last.launch_date_unix).to eq 1_569_888_000
|
@@ -208,6 +208,124 @@ describe SPACEX::Launches do
|
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
|
+
context '#info(68)', vcr: { cassette_name: 'launches/68' } do
|
212
|
+
subject do
|
213
|
+
SPACEX::Launches.info(68)
|
214
|
+
end
|
215
|
+
|
216
|
+
it 'returns info for flight number 68' do
|
217
|
+
expect(subject.flight_number).to eq(68)
|
218
|
+
expect(subject.rocket.rocket_name).to eq('Falcon 9')
|
219
|
+
expect(subject.rocket.first_stage.cores.first.core_serial).to eq('B1049')
|
220
|
+
expect(subject.rocket.second_stage.payloads.first.orbit_params.regime).to eq('geostationary')
|
221
|
+
|
222
|
+
expect(subject).to eq(
|
223
|
+
'flight_number' => 68,
|
224
|
+
'mission_name' => 'Telstar 18V',
|
225
|
+
'mission_id' => [
|
226
|
+
'F4F83DE'
|
227
|
+
],
|
228
|
+
'launch_year' => '2018',
|
229
|
+
'launch_date_unix' => 1_536_554_700,
|
230
|
+
'launch_date_utc' => '2018-09-10T04:45:00.000Z',
|
231
|
+
'launch_date_local' => '2018-09-10T00:45:00-04:00',
|
232
|
+
'is_tentative' => false,
|
233
|
+
'tentative_max_precision' => 'hour',
|
234
|
+
'rocket' => {
|
235
|
+
'rocket_id' => 'falcon9',
|
236
|
+
'rocket_name' => 'Falcon 9',
|
237
|
+
'rocket_type' => 'FT',
|
238
|
+
'first_stage' => {
|
239
|
+
'cores' => [{
|
240
|
+
'core_serial' => 'B1049',
|
241
|
+
'flight' => 1,
|
242
|
+
'block' => 5,
|
243
|
+
'reused' => false,
|
244
|
+
'land_success' => true,
|
245
|
+
'landing_intent' => true,
|
246
|
+
'landing_type' => 'ASDS',
|
247
|
+
'landing_vehicle' => 'OCISLY'
|
248
|
+
}]
|
249
|
+
},
|
250
|
+
'second_stage' => {
|
251
|
+
'block' => 5,
|
252
|
+
'payloads' => [{
|
253
|
+
'payload_id' => 'Telstar 18V',
|
254
|
+
'norad_id' => [43_611],
|
255
|
+
'reused' => false,
|
256
|
+
'customers' => ['Telesat'],
|
257
|
+
'nationality' => 'Canada',
|
258
|
+
'manufacturer' => 'SSL',
|
259
|
+
'payload_type' => 'Satellite',
|
260
|
+
'payload_mass_kg' => 7060,
|
261
|
+
'payload_mass_lbs' => 15_564.64,
|
262
|
+
'orbit' => 'GTO',
|
263
|
+
'orbit_params' => {
|
264
|
+
'reference_system' => 'geocentric',
|
265
|
+
'regime' => 'geostationary',
|
266
|
+
'longitude' => 138,
|
267
|
+
'semi_major_axis_km' => 7226.647,
|
268
|
+
'eccentricity' => 0.0013608,
|
269
|
+
'periapsis_km' => 838.677,
|
270
|
+
'apoapsis_km' => 858.346,
|
271
|
+
'inclination_deg' => 98.8086,
|
272
|
+
'period_min' => 101.897,
|
273
|
+
'lifespan_years' => 15,
|
274
|
+
'epoch' => '2018-09-07T06:29:40.000Z',
|
275
|
+
'mean_motion' => 14.13180055,
|
276
|
+
'raan' => 322.194,
|
277
|
+
'arg_of_pericenter' => 130.3173,
|
278
|
+
'mean_anomaly' => 328.1487
|
279
|
+
}
|
280
|
+
}]
|
281
|
+
},
|
282
|
+
'fairings' => {
|
283
|
+
'reused' => false,
|
284
|
+
'recovery_attempt' => false,
|
285
|
+
'recovered' => false,
|
286
|
+
'ship' => nil
|
287
|
+
}
|
288
|
+
},
|
289
|
+
'ships' => %w[OCISLY HAWK GOQUEST],
|
290
|
+
'telemetry' => {
|
291
|
+
'flight_club' => 'https://www.flightclub.io/result/2d?code=T18V'
|
292
|
+
},
|
293
|
+
'launch_site' => {
|
294
|
+
'site_id' => 'ccafs_slc_40',
|
295
|
+
'site_name' => 'CCAFS SLC 40',
|
296
|
+
'site_name_long' => 'Cape Canaveral Air Force Station Space Launch Complex 40'
|
297
|
+
},
|
298
|
+
'launch_success' => true,
|
299
|
+
'links' => {
|
300
|
+
'mission_patch' => 'https://images2.imgbox.com/ba/db/3plcm5IB_o.png',
|
301
|
+
'mission_patch_small' => 'https://images2.imgbox.com/2d/d2/jStsqeLC_o.png',
|
302
|
+
'reddit_campaign' => 'https://www.reddit.com/r/spacex/comments/95cte4/telstar_18v_apstar_5c_launch_campaign_thread/',
|
303
|
+
'reddit_launch' => 'https://www.reddit.com/r/spacex/comments/9e7bmq/rspacex_telstar_18v_official_launch_discussion/',
|
304
|
+
'reddit_recovery' => 'https://www.reddit.com/r/spacex/comments/9erxlh/telstar_18_vantage_recovery_thread/',
|
305
|
+
'reddit_media' => 'https://www.reddit.com/r/spacex/comments/9ebkqw/rspacex_telstar_18v_media_thread_videos_images/',
|
306
|
+
'presskit' => 'https://www.spacex.com/sites/spacex/files/telstar18vantagepresskit.pdf',
|
307
|
+
'article_link' => 'https://spaceflightnow.com/2018/09/10/spacex-telesat-achieve-repeat-success-with-midnight-hour-launch/',
|
308
|
+
'wikipedia' => 'https://en.wikipedia.org/wiki/Telstar_18V',
|
309
|
+
'video_link' => 'https://www.youtube.com/watch?v=Apw3xqwsG1U',
|
310
|
+
'flickr_images' => [
|
311
|
+
'https://farm2.staticflickr.com/1878/43690848045_492ef182dd_o.jpg',
|
312
|
+
'https://farm2.staticflickr.com/1856/43881229604_6d42e838b6_o.jpg',
|
313
|
+
'https://farm2.staticflickr.com/1852/43881223704_93777e34af_o.jpg',
|
314
|
+
'https://farm2.staticflickr.com/1841/43881217094_558b7b214e_o.jpg',
|
315
|
+
'https://farm2.staticflickr.com/1869/43881193934_423eff8c86_o.jpg'
|
316
|
+
]
|
317
|
+
},
|
318
|
+
'details' => 'SpaceX\'s sixteenth flight of 2018 launched the Telstar '\
|
319
|
+
'18v GEO communication satellite for Telesat, the second launch for '\
|
320
|
+
'the canadian company in a few months. The first stage was a new '\
|
321
|
+
'Falcon 9 V1.2 Block 5 which was successfully recovered on OCISLY.',
|
322
|
+
'upcoming' => false,
|
323
|
+
'static_fire_date_utc' => '2018-09-05T07:21:00.000Z',
|
324
|
+
'static_fire_date_unix' => 1_536_132_060
|
325
|
+
)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
211
329
|
context '#next', vcr: { cassette_name: 'launches/next' } do
|
212
330
|
subject do
|
213
331
|
SPACEX::Launches.next
|
@@ -274,4 +392,261 @@ describe SPACEX::Launches do
|
|
274
392
|
expect(subject.static_fire_date_utc).to eq nil
|
275
393
|
end
|
276
394
|
end
|
395
|
+
|
396
|
+
context '#upcoming', vcr: { cassette_name: 'launches/upcoming' } do
|
397
|
+
subject do
|
398
|
+
SPACEX::Launches.upcoming
|
399
|
+
end
|
400
|
+
|
401
|
+
it 'returns and array of upcoming launch hashes' do
|
402
|
+
expect(subject).to be_an Array
|
403
|
+
expect(subject.first).to be_a Hash
|
404
|
+
expect(subject.all?(&:upcoming)).to be true
|
405
|
+
end
|
406
|
+
|
407
|
+
it 'returns launches scheduled in the future' do
|
408
|
+
subject.each do |launch|
|
409
|
+
expect(launch.launch_year).to be >= Time.now.year.to_s
|
410
|
+
expect(Time.parse(launch.launch_date_utc)).to be >= Time.now.utc
|
411
|
+
expect(launch.rocket.first_stage.cores.first.land_success).to be nil
|
412
|
+
expect(launch.launch_success).to be nil
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
context 'returns upcoming launches' do
|
417
|
+
it 'returns the next upcoming launch' do
|
418
|
+
expect(subject.first.flight_number).to eq 70
|
419
|
+
expect(subject.first.mission_name).to eq 'Es’hail 2'
|
420
|
+
expect(subject.first.mission_id).to eq []
|
421
|
+
expect(subject.first.launch_year).to eq '2018'
|
422
|
+
expect(subject.first.launch_date_unix).to eq 1_542_228_360
|
423
|
+
expect(subject.first.launch_date_utc).to eq '2018-11-14T20:46:00.000Z'
|
424
|
+
expect(subject.first.launch_date_local).to eq '2018-11-14T15:46:00-05:00'
|
425
|
+
expect(subject.first.is_tentative).to eq true
|
426
|
+
expect(subject.first.tentative_max_precision).to eq 'hour'
|
427
|
+
expect(subject.first.rocket.rocket_id).to eq 'falcon9'
|
428
|
+
expect(subject.first.rocket.rocket_name).to eq 'Falcon 9'
|
429
|
+
expect(subject.first.rocket.rocket_type).to eq 'FT'
|
430
|
+
expect(subject.first.rocket.first_stage.cores).to be_an(Array)
|
431
|
+
expect(subject.first.rocket.first_stage.cores.first).to eq(
|
432
|
+
'core_serial' => nil,
|
433
|
+
'flight' => nil,
|
434
|
+
'block' => 5,
|
435
|
+
'gridfins' => true,
|
436
|
+
'legs' => true,
|
437
|
+
'reused' => false,
|
438
|
+
'land_success' => nil,
|
439
|
+
'landing_intent' => true,
|
440
|
+
'landing_type' => 'ASDS',
|
441
|
+
'landing_vehicle' => 'OCISLY'
|
442
|
+
)
|
443
|
+
expect(subject.first.rocket.second_stage.block).to eq 5
|
444
|
+
expect(subject.first.rocket.second_stage.payloads).to be_an(Array)
|
445
|
+
expect(subject.first.rocket.second_stage.payloads.first).to eq(
|
446
|
+
'payload_id' => 'Es’hail 2',
|
447
|
+
'norad_id' => [],
|
448
|
+
'reused' => false,
|
449
|
+
'customers' => ['Es’hailSat'],
|
450
|
+
'nationality' => 'Qatar',
|
451
|
+
'manufacturer' => 'Mitsubishi Electric',
|
452
|
+
'payload_type' => 'Satellite',
|
453
|
+
'payload_mass_kg' => 3000,
|
454
|
+
'payload_mass_lbs' => 6613.868,
|
455
|
+
'orbit' => 'GTO',
|
456
|
+
'orbit_params' => {
|
457
|
+
'reference_system' => 'geocentric',
|
458
|
+
'regime' => 'geostationary',
|
459
|
+
'longitude' => 25.5,
|
460
|
+
'semi_major_axis_km' => nil,
|
461
|
+
'eccentricity' => nil,
|
462
|
+
'periapsis_km' => nil,
|
463
|
+
'apoapsis_km' => nil,
|
464
|
+
'inclination_deg' => nil,
|
465
|
+
'period_min' => nil,
|
466
|
+
'lifespan_years' => 15,
|
467
|
+
'epoch' => nil,
|
468
|
+
'mean_motion' => nil,
|
469
|
+
'raan' => nil,
|
470
|
+
'arg_of_pericenter' => nil,
|
471
|
+
'mean_anomaly' => nil
|
472
|
+
}
|
473
|
+
)
|
474
|
+
expect(subject.first.rocket.fairings).to eq(
|
475
|
+
'reused' => false,
|
476
|
+
'recovery_attempt' => false,
|
477
|
+
'recovered' => false,
|
478
|
+
'ship' => nil
|
479
|
+
)
|
480
|
+
expect(subject.first.ships).to eq []
|
481
|
+
expect(subject.first.telemetry.flight_club).to eq nil
|
482
|
+
expect(subject.first.launch_site).to eq(
|
483
|
+
'site_id' => 'ccafs_slc_40',
|
484
|
+
'site_name' => 'CCAFS SLC 40',
|
485
|
+
'site_name_long' => 'Cape Canaveral Air Force Station Space Launch Complex 40'
|
486
|
+
)
|
487
|
+
expect(subject.first.launch_success).to eq nil
|
488
|
+
expect(subject.first.links).to eq(
|
489
|
+
'mission_patch' => nil,
|
490
|
+
'mission_patch_small' => nil,
|
491
|
+
'reddit_campaign' => 'https://www.reddit.com/r/spacex/comments/9p82jt/eshail_2_launch_campaign_thread/',
|
492
|
+
'reddit_launch' => nil,
|
493
|
+
'reddit_recovery' => nil,
|
494
|
+
'reddit_media' => nil,
|
495
|
+
'presskit' => nil,
|
496
|
+
'article_link' => nil,
|
497
|
+
'wikipedia' => nil,
|
498
|
+
'video_link' => nil,
|
499
|
+
'flickr_images' => []
|
500
|
+
)
|
501
|
+
expect(subject.first.details).to eq 'SpaceX\'s eighteenth flight of 2018 will '\
|
502
|
+
'be its first for Es\'hailSat. Es\'hail-2 is a communications satellite '\
|
503
|
+
'that will deliver television and internet to Qatar and the surrounding '\
|
504
|
+
'region. It will be launched into a geostationary transfer orbit from '\
|
505
|
+
'LC-39A at Kennedy Space Center. The booster is expected to land on OCISLY.'
|
506
|
+
expect(subject.first.upcoming).to eq true
|
507
|
+
expect(subject.first.static_fire_date_utc).to eq nil
|
508
|
+
expect(subject.first.static_fire_date_unix).to eq nil
|
509
|
+
end
|
510
|
+
|
511
|
+
it 'returns the last upcoming launch' do
|
512
|
+
expect(subject.last.flight_number).to eq 91
|
513
|
+
expect(subject.last.mission_name).to eq 'GPS IIIA-3'
|
514
|
+
expect(subject.last.mission_id).to eq []
|
515
|
+
expect(subject.last.launch_year).to eq '2019'
|
516
|
+
expect(subject.last.launch_date_unix).to eq 1_569_888_000
|
517
|
+
expect(subject.last.launch_date_utc).to eq '2019-10-01T00:00:00.000Z'
|
518
|
+
expect(subject.last.launch_date_local).to eq '2019-09-30T20:00:00-04:00'
|
519
|
+
expect(subject.last.is_tentative).to eq true
|
520
|
+
expect(subject.last.tentative_max_precision).to eq 'month'
|
521
|
+
expect(subject.last.rocket.rocket_id).to eq 'falcon9'
|
522
|
+
expect(subject.last.rocket.rocket_name).to eq 'Falcon 9'
|
523
|
+
expect(subject.last.rocket.rocket_type).to eq 'FT'
|
524
|
+
expect(subject.last.rocket.first_stage.cores).to be_an(Array)
|
525
|
+
expect(subject.last.rocket.first_stage.cores.first).to eq(
|
526
|
+
'core_serial' => nil,
|
527
|
+
'flight' => nil,
|
528
|
+
'block' => nil,
|
529
|
+
'gridfins' => nil,
|
530
|
+
'legs' => nil,
|
531
|
+
'reused' => false,
|
532
|
+
'land_success' => nil,
|
533
|
+
'landing_intent' => nil,
|
534
|
+
'landing_type' => nil,
|
535
|
+
'landing_vehicle' => nil
|
536
|
+
)
|
537
|
+
expect(subject.last.rocket.second_stage.block).to eq nil
|
538
|
+
expect(subject.last.rocket.second_stage.payloads).to be_an(Array)
|
539
|
+
expect(subject.last.rocket.second_stage.payloads.first).to eq(
|
540
|
+
'payload_id' => 'GPS IIIA-3',
|
541
|
+
'norad_id' => [],
|
542
|
+
'reused' => false,
|
543
|
+
'customers' => ['USAF'],
|
544
|
+
'nationality' => 'United States',
|
545
|
+
'manufacturer' => 'Lockheed Martin',
|
546
|
+
'payload_type' => 'Satellite',
|
547
|
+
'payload_mass_kg' => 3880,
|
548
|
+
'payload_mass_lbs' => 8553.94,
|
549
|
+
'orbit' => 'MEO',
|
550
|
+
'orbit_params' => {
|
551
|
+
'reference_system' => nil,
|
552
|
+
'regime' => nil,
|
553
|
+
'longitude' => nil,
|
554
|
+
'semi_major_axis_km' => nil,
|
555
|
+
'eccentricity' => nil,
|
556
|
+
'periapsis_km' => nil,
|
557
|
+
'apoapsis_km' => nil,
|
558
|
+
'inclination_deg' => nil,
|
559
|
+
'period_min' => nil,
|
560
|
+
'lifespan_years' => 15,
|
561
|
+
'epoch' => nil,
|
562
|
+
'mean_motion' => nil,
|
563
|
+
'raan' => nil,
|
564
|
+
'arg_of_pericenter' => nil,
|
565
|
+
'mean_anomaly' => nil
|
566
|
+
}
|
567
|
+
)
|
568
|
+
expect(subject.last.rocket.fairings).to eq(
|
569
|
+
'reused' => false,
|
570
|
+
'recovery_attempt' => nil,
|
571
|
+
'recovered' => nil,
|
572
|
+
'ship' => nil
|
573
|
+
)
|
574
|
+
expect(subject.last.ships).to eq []
|
575
|
+
expect(subject.last.telemetry.flight_club).to eq nil
|
576
|
+
expect(subject.last.launch_site).to eq(
|
577
|
+
'site_id' => 'ccafs_slc_40',
|
578
|
+
'site_name' => 'CCAFS SLC 40',
|
579
|
+
'site_name_long' => 'Cape Canaveral Air Force Station Space Launch Complex 40'
|
580
|
+
)
|
581
|
+
expect(subject.last.launch_success).to eq nil
|
582
|
+
expect(subject.last.links).to eq(
|
583
|
+
'mission_patch' => nil,
|
584
|
+
'mission_patch_small' => nil,
|
585
|
+
'reddit_campaign' => nil,
|
586
|
+
'reddit_launch' => nil,
|
587
|
+
'reddit_recovery' => nil,
|
588
|
+
'reddit_media' => nil,
|
589
|
+
'presskit' => nil,
|
590
|
+
'article_link' => nil,
|
591
|
+
'wikipedia' => nil,
|
592
|
+
'video_link' => nil,
|
593
|
+
'flickr_images' => []
|
594
|
+
)
|
595
|
+
expect(subject.last.details).to eq nil
|
596
|
+
expect(subject.last.upcoming).to eq true
|
597
|
+
expect(subject.last.static_fire_date_utc).to eq nil
|
598
|
+
expect(subject.last.static_fire_date_unix).to eq nil
|
599
|
+
end
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
context '#all', vcr: { cassette_name: 'launches/all' } do
|
604
|
+
subject do
|
605
|
+
SPACEX::Launches.all
|
606
|
+
end
|
607
|
+
|
608
|
+
it 'returns all launches' do
|
609
|
+
expect(subject.first.flight_number).to eq 1
|
610
|
+
expect(subject.first.mission_name).to eq 'FalconSat'
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
614
|
+
context '#past', vcr: { cassette_name: 'launches/past' } do
|
615
|
+
subject do
|
616
|
+
SPACEX::Launches.past
|
617
|
+
end
|
618
|
+
|
619
|
+
it 'returns and array of launch hashes' do
|
620
|
+
expect(subject).to be_an Array
|
621
|
+
expect(subject.first).to be_a Hash
|
622
|
+
end
|
623
|
+
|
624
|
+
it 'returns the correct number of launches' do
|
625
|
+
expect(subject.count).to eq 69
|
626
|
+
end
|
627
|
+
|
628
|
+
context 'returns past launches' do
|
629
|
+
it 'returns the first launch' do
|
630
|
+
expect(subject.first.flight_number).to eq(1)
|
631
|
+
expect(subject.first.mission_name).to eq('FalconSat')
|
632
|
+
expect(subject.first.rocket.rocket_name).to eq('Falcon 1')
|
633
|
+
expect(subject.first.rocket.first_stage.cores.first.core_serial).to eq('Merlin1A')
|
634
|
+
expect(subject.first.rocket.second_stage.payloads.first.payload_id).to eq('FalconSAT-2')
|
635
|
+
expect(subject.first.rocket.second_stage.payloads.first.orbit_params.regime).to eq('low-earth')
|
636
|
+
expect(subject.first.launch_site.site_id).to eq('kwajalein_atoll')
|
637
|
+
expect(subject.first.launch_success).to eq(false)
|
638
|
+
end
|
639
|
+
|
640
|
+
it 'returns the last past launch' do
|
641
|
+
expect(subject.last.flight_number).to eq(69)
|
642
|
+
expect(subject.last.mission_name).to eq('SAOCOM 1A')
|
643
|
+
expect(subject.last.rocket.rocket_name).to eq('Falcon 9')
|
644
|
+
expect(subject.last.rocket.first_stage.cores.first.core_serial).to eq('B1048')
|
645
|
+
expect(subject.last.rocket.second_stage.payloads.first.payload_id).to eq('SAOCOM 1A')
|
646
|
+
expect(subject.last.rocket.second_stage.payloads.first.orbit_params.regime).to eq('sun-synchronous')
|
647
|
+
expect(subject.last.launch_site.site_id).to eq('vafb_slc_4e')
|
648
|
+
expect(subject.last.launch_success).to eq(true)
|
649
|
+
end
|
650
|
+
end
|
651
|
+
end
|
277
652
|
end
|