starwars 0.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 +7 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +26 -0
- data/Gemfile +17 -0
- data/Guardfile +16 -0
- data/LICENSE.txt +22 -0
- data/README.md +59 -0
- data/Rakefile +27 -0
- data/lib/starwars.rb +19 -0
- data/lib/starwars/base.rb +54 -0
- data/lib/starwars/fetcher.rb +40 -0
- data/lib/starwars/film.rb +35 -0
- data/lib/starwars/person.rb +39 -0
- data/lib/starwars/planet.rb +37 -0
- data/lib/starwars/specie.rb +38 -0
- data/lib/starwars/starship.rb +40 -0
- data/lib/starwars/vehicle.rb +38 -0
- data/lib/starwars/version.rb +4 -0
- data/spec/fixtures/films_1.json +1 -0
- data/spec/fixtures/people_1.json +1 -0
- data/spec/fixtures/people_2.json +1 -0
- data/spec/fixtures/planets_1.json +1 -0
- data/spec/fixtures/species_1.json +1 -0
- data/spec/fixtures/starships_10.json +1 -0
- data/spec/fixtures/starships_5.json +1 -0
- data/spec/fixtures/vehicles_14.json +1 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/starwars/film_spec.rb +132 -0
- data/spec/starwars/person_spec.rb +150 -0
- data/spec/starwars/planet_spec.rb +128 -0
- data/spec/starwars/species_spec.rb +125 -0
- data/spec/starwars/starship_spec.rb +144 -0
- data/spec/starwars/vehicle_spec.rb +130 -0
- data/starwars.gemspec +26 -0
- metadata +166 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
describe Starwars::Planet do
|
2
|
+
before do
|
3
|
+
stub_get('/planets/1/').to_return(body: fixture('planets_1.json'), headers: { content_type: 'application/json; charset=utf-8' })
|
4
|
+
end
|
5
|
+
|
6
|
+
describe '#==' do
|
7
|
+
it 'returns true when objects IDs and URLS are the same' do
|
8
|
+
planet = Starwars::Planet.new(id: 1, name: 'foo')
|
9
|
+
other = Starwars::Planet.new(id: 1, name: 'bar')
|
10
|
+
expect(planet == other).to be true
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'returns false when objects IDs are different' do
|
14
|
+
planet = Starwars::Planet.new(id: 1)
|
15
|
+
other = Starwars::Planet.new(id: 2)
|
16
|
+
expect(planet == other).to be false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'getters' do
|
21
|
+
subject(:planet) { Starwars::Planet.fetch(1) }
|
22
|
+
describe '#created' do
|
23
|
+
it 'returns a Time when updated is set' do
|
24
|
+
expect(planet.created).to be_a Time
|
25
|
+
end
|
26
|
+
end
|
27
|
+
describe '#edited' do
|
28
|
+
it 'returns a Time when edited is set' do
|
29
|
+
expect(planet.edited).to be_a Time
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#name' do
|
34
|
+
it 'should have the correct value' do
|
35
|
+
expect(planet.name).to eq 'Tatooine'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
describe '#terrain' do
|
39
|
+
it 'should have the correct value' do
|
40
|
+
expect(planet.terrain).to eq 'desert'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
describe '#gravity' do
|
44
|
+
it 'should have the correct value' do
|
45
|
+
expect(planet.gravity).to eq '1 standard'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
describe '#climate' do
|
49
|
+
it 'should have the correct value' do
|
50
|
+
expect(planet.climate).to eq 'arid'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
describe '#url' do
|
54
|
+
it 'should have the correct value' do
|
55
|
+
expect(planet.url).to eq 'http://swapi.co/api/planets/1/'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#population' do
|
60
|
+
it 'should be an integer' do
|
61
|
+
expect(planet.population).to be_an Integer
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should should have the correct value' do
|
65
|
+
expect(planet.population).to eq 200_000
|
66
|
+
end
|
67
|
+
end
|
68
|
+
describe '#surface_water' do
|
69
|
+
it 'should be an integer' do
|
70
|
+
expect(planet.surface_water).to be_an Integer
|
71
|
+
end
|
72
|
+
it 'should have the correct value' do
|
73
|
+
expect(planet.surface_water).to eq 1
|
74
|
+
end
|
75
|
+
end
|
76
|
+
describe '#rotation_period' do
|
77
|
+
it 'should be an integer' do
|
78
|
+
expect(planet.rotation_period).to be_an Integer
|
79
|
+
end
|
80
|
+
it 'should should have the correct value' do
|
81
|
+
expect(planet.rotation_period).to eq 23
|
82
|
+
end
|
83
|
+
end
|
84
|
+
describe '#orbital_period' do
|
85
|
+
it 'should be an integer' do
|
86
|
+
expect(planet.rotation_period).to be_an Integer
|
87
|
+
end
|
88
|
+
it 'should should have the correct value' do
|
89
|
+
expect(planet.orbital_period).to eq 304
|
90
|
+
end
|
91
|
+
end
|
92
|
+
describe '#diameter' do
|
93
|
+
it 'should be an integer' do
|
94
|
+
expect(planet.diameter).to be_an Integer
|
95
|
+
end
|
96
|
+
it 'should should have the correct value' do
|
97
|
+
expect(planet.diameter).to eq 104_65
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe '#residents' do
|
102
|
+
it 'should return an Array' do
|
103
|
+
expect(planet.residents).to be_an Array
|
104
|
+
end
|
105
|
+
it 'should should the correct number of residents' do
|
106
|
+
expect(planet.residents.size).to eq 10
|
107
|
+
end
|
108
|
+
it 'should contain an array of people correctly parsed' do
|
109
|
+
person = planet.residents.first
|
110
|
+
expect(person).to be_a Starwars::Person
|
111
|
+
expect(person.url).to eq 'http://swapi.co/api/people/1/'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
describe '#films' do
|
115
|
+
it 'should return an Array' do
|
116
|
+
expect(planet.films).to be_an Array
|
117
|
+
end
|
118
|
+
it 'should should the correct number of residents' do
|
119
|
+
expect(planet.films.size).to eq 5
|
120
|
+
end
|
121
|
+
it 'should contain an array of films correctly parsed' do
|
122
|
+
film = planet.films.first
|
123
|
+
expect(film).to be_a Starwars::Film
|
124
|
+
expect(film.url).to eq 'http://swapi.co/api/films/1/'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
describe Starwars::Specie do
|
2
|
+
before do
|
3
|
+
stub_get('/species/1/').to_return(body: fixture('species_1.json'), headers: { content_type: 'application/json; charset=utf-8' })
|
4
|
+
end
|
5
|
+
|
6
|
+
describe '#==' do
|
7
|
+
it 'returns true when objects IDs and URLS are the same' do
|
8
|
+
specie = Starwars::Specie.new(id: 1, title: 'foo')
|
9
|
+
other = Starwars::Specie.new(id: 1, title: 'bar')
|
10
|
+
expect(specie == other).to be true
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'returns false when objects IDs are different' do
|
14
|
+
specie = Starwars::Specie.new(id: 1)
|
15
|
+
other = Starwars::Specie.new(id: 2)
|
16
|
+
expect(specie == other).to be false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
describe 'getters' do
|
20
|
+
subject(:specie) { Starwars::Specie.fetch(1) }
|
21
|
+
describe '#created' do
|
22
|
+
it 'returns a Time when updated is set' do
|
23
|
+
expect(specie.created).to be_a Time
|
24
|
+
end
|
25
|
+
end
|
26
|
+
describe '#edited' do
|
27
|
+
it 'returns a Time when edited is set' do
|
28
|
+
expect(specie.edited).to be_a Time
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#name' do
|
33
|
+
it 'should have the correct value' do
|
34
|
+
expect(specie.name).to eq 'Human'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
describe '#classification' do
|
38
|
+
it 'should have the correct value' do
|
39
|
+
expect(specie.classification).to eq 'mammal'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
describe '#designation' do
|
43
|
+
it 'should have the correct value' do
|
44
|
+
expect(specie.designation).to eq 'sentient'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
describe '#skin_colors' do
|
48
|
+
it 'should have the correct value' do
|
49
|
+
expect(specie.skin_colors).to eq 'caucasian, black, asian, hispanic'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
describe '#hair_colors' do
|
53
|
+
it 'should have the correct value' do
|
54
|
+
expect(specie.hair_colors).to eq 'blonde, brown, black, red'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
describe '#eye_colors' do
|
58
|
+
it 'should have the correct value' do
|
59
|
+
expect(specie.eye_colors).to eq 'brown, blue, green, hazel, grey, amber'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
describe '#language' do
|
63
|
+
it 'should have the correct value' do
|
64
|
+
expect(specie.language).to eq 'Galactic Basic'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
describe '#url' do
|
68
|
+
it 'should have the correct value' do
|
69
|
+
expect(specie.url).to eq 'http://swapi.co/api/species/1/'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe '#homeworld' do
|
74
|
+
it 'should return a Starwars::Planet object' do
|
75
|
+
expect(specie.homeworld).to be_an Starwars::Planet
|
76
|
+
end
|
77
|
+
it 'should contains the correct resouce url' do
|
78
|
+
expect(specie.homeworld.url).to eq 'http://swapi.co/api/planets/9/'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe '#average_height' do
|
83
|
+
it 'should be an integer' do
|
84
|
+
expect(specie.average_height).to be_an Integer
|
85
|
+
end
|
86
|
+
it 'should should have the correct value' do
|
87
|
+
expect(specie.average_height).to eq 180
|
88
|
+
end
|
89
|
+
end
|
90
|
+
describe '#average_lifespan' do
|
91
|
+
it 'should be an integer' do
|
92
|
+
expect(specie.average_lifespan).to be_an Integer
|
93
|
+
end
|
94
|
+
it 'should should have the correct value' do
|
95
|
+
expect(specie.average_lifespan).to eq 120
|
96
|
+
end
|
97
|
+
end
|
98
|
+
describe '#people' do
|
99
|
+
it 'should return an Array' do
|
100
|
+
expect(specie.people).to be_an Array
|
101
|
+
end
|
102
|
+
it 'should should the correct number of people' do
|
103
|
+
expect(specie.people.size).to eq 4
|
104
|
+
end
|
105
|
+
it 'should contain an array of people correctly parsed' do
|
106
|
+
person = specie.people.first
|
107
|
+
expect(person).to be_a Starwars::Person
|
108
|
+
expect(person.url).to eq 'http://swapi.co/api/people/66/'
|
109
|
+
end
|
110
|
+
end
|
111
|
+
describe '#films' do
|
112
|
+
it 'should return an Array' do
|
113
|
+
expect(specie.films).to be_an Array
|
114
|
+
end
|
115
|
+
it 'should should the correct number of films' do
|
116
|
+
expect(specie.films.size).to eq 6
|
117
|
+
end
|
118
|
+
it 'should contain an array of films correctly parsed' do
|
119
|
+
film = specie.films.first
|
120
|
+
expect(film).to be_a Starwars::Film
|
121
|
+
expect(film.url).to eq 'http://swapi.co/api/films/1/'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
describe Starwars::Starship do
|
2
|
+
before do
|
3
|
+
stub_get('/starships/5/').to_return(body: fixture('starships_5.json'), headers: { content_type: 'application/json; charset=utf-8' })
|
4
|
+
stub_get('/starships/10/').to_return(body: fixture('starships_10.json'), headers: { content_type: 'application/json; charset=utf-8' })
|
5
|
+
end
|
6
|
+
|
7
|
+
describe '#==' do
|
8
|
+
it 'returns true when objects IDs and URLS are the same' do
|
9
|
+
starship = Starwars::Starship.new(id: 1, title: 'foo')
|
10
|
+
other = Starwars::Starship.new(id: 1, title: 'bar')
|
11
|
+
expect(starship == other).to be true
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns false when objects IDs are different' do
|
15
|
+
starship = Starwars::Starship.new(id: 1)
|
16
|
+
other = Starwars::Starship.new(id: 2)
|
17
|
+
expect(starship == other).to be false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'getters' do
|
22
|
+
subject(:starship) { Starwars::Starship.fetch(5) }
|
23
|
+
subject(:mf) { Starwars::Starship.fetch(10) }
|
24
|
+
describe '#created' do
|
25
|
+
it 'returns a Time when updated is set' do
|
26
|
+
expect(starship.created).to be_a Time
|
27
|
+
end
|
28
|
+
end
|
29
|
+
describe '#edited' do
|
30
|
+
it 'returns a Time when edited is set' do
|
31
|
+
expect(starship.edited).to be_a Time
|
32
|
+
end
|
33
|
+
end
|
34
|
+
describe '#name' do
|
35
|
+
it 'should have the correct value' do
|
36
|
+
expect(starship.name).to eq 'Sentinel-class landing craft'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
describe '#model' do
|
40
|
+
it 'should have the correct value' do
|
41
|
+
expect(starship.model).to eq 'Sentinel-class landing craft'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
describe '#manufacturer' do
|
45
|
+
it 'should have the correct value' do
|
46
|
+
expect(starship.manufacturer).to eq 'Sienar Fleet Systems, Cyngus Spaceworks'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
describe '#starship_class' do
|
50
|
+
it 'should have the correct value' do
|
51
|
+
expect(starship.starship_class).to eq 'landing craft'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
describe '#consumables' do
|
55
|
+
it 'should have the correct value' do
|
56
|
+
expect(starship.consumables).to eq '1 month'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#cost_in_credits' do
|
61
|
+
it 'should be an integer' do
|
62
|
+
expect(starship.cost_in_credits).to be_an Integer
|
63
|
+
end
|
64
|
+
it 'should should have the correct value' do
|
65
|
+
expect(starship.cost_in_credits).to eq 240_000
|
66
|
+
end
|
67
|
+
end
|
68
|
+
describe '#length' do
|
69
|
+
it 'should be an integer' do
|
70
|
+
expect(starship.length).to be_an Integer
|
71
|
+
end
|
72
|
+
it 'should should have the correct value' do
|
73
|
+
expect(starship.length).to eq 38
|
74
|
+
end
|
75
|
+
end
|
76
|
+
describe '#max_atmosphering_speed' do
|
77
|
+
it 'should be an integer' do
|
78
|
+
expect(starship.max_atmosphering_speed).to be_an Integer
|
79
|
+
end
|
80
|
+
it 'should should have the correct value' do
|
81
|
+
expect(starship.max_atmosphering_speed).to eq 1_000
|
82
|
+
end
|
83
|
+
end
|
84
|
+
describe '#crew' do
|
85
|
+
it 'should be an integer' do
|
86
|
+
expect(starship.crew).to be_an Integer
|
87
|
+
end
|
88
|
+
it 'should should have the correct value' do
|
89
|
+
expect(starship.crew).to eq 5
|
90
|
+
end
|
91
|
+
end
|
92
|
+
describe '#passengers' do
|
93
|
+
it 'should be an integer' do
|
94
|
+
expect(starship.passengers).to be_an Integer
|
95
|
+
end
|
96
|
+
it 'should should have the correct value' do
|
97
|
+
expect(starship.passengers).to eq 75
|
98
|
+
end
|
99
|
+
end
|
100
|
+
describe '#cargo_capacity' do
|
101
|
+
it 'should be an integer' do
|
102
|
+
expect(starship.cargo_capacity).to be_an Integer
|
103
|
+
end
|
104
|
+
it 'should should have the correct value' do
|
105
|
+
expect(starship.cargo_capacity).to eq 180_000
|
106
|
+
end
|
107
|
+
end
|
108
|
+
describe '#hyperdrive_rating' do
|
109
|
+
it 'should be an integer' do
|
110
|
+
expect(starship.hyperdrive_rating).to be_an Float
|
111
|
+
end
|
112
|
+
it 'should should have the correct value' do
|
113
|
+
expect(starship.hyperdrive_rating).to eq 1.0
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe '#films' do
|
118
|
+
it 'should return an Array' do
|
119
|
+
expect(starship.films).to be_an Array
|
120
|
+
end
|
121
|
+
it 'should should the correct number of films' do
|
122
|
+
expect(starship.films.size).to eq 1
|
123
|
+
end
|
124
|
+
it 'should contain an array of films correctly parsed' do
|
125
|
+
film = starship.films.first
|
126
|
+
expect(film).to be_a Starwars::Film
|
127
|
+
expect(film.url).to eq 'http://swapi.co/api/films/1/'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
describe '#pilots' do
|
131
|
+
it 'should return an Array' do
|
132
|
+
expect(mf.pilots).to be_an Array
|
133
|
+
end
|
134
|
+
it 'should should the correct number of pilots' do
|
135
|
+
expect(mf.pilots.size).to eq 4
|
136
|
+
end
|
137
|
+
it 'should contain an array of pilots correctly parsed' do
|
138
|
+
person = mf.pilots.first
|
139
|
+
expect(person).to be_a Starwars::Person
|
140
|
+
expect(person.url).to eq 'http://swapi.co/api/people/13/'
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
describe Starwars::Vehicle do
|
2
|
+
before do
|
3
|
+
stub_get('/vehicles/14/').to_return(body: fixture('vehicles_14.json'), headers: { content_type: 'application/json; charset=utf-8' })
|
4
|
+
end
|
5
|
+
|
6
|
+
describe '#==' do
|
7
|
+
it 'returns true when objects IDs and URLS are the same' do
|
8
|
+
starship = Starwars::Vehicle.new(id: 1, title: 'foo')
|
9
|
+
other = Starwars::Vehicle.new(id: 1, title: 'bar')
|
10
|
+
expect(starship == other).to be true
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'returns false when objects IDs are different' do
|
14
|
+
starship = Starwars::Vehicle.new(id: 1)
|
15
|
+
other = Starwars::Vehicle.new(id: 2)
|
16
|
+
expect(starship == other).to be false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'getters' do
|
21
|
+
subject(:vehicle) { Starwars::Vehicle.fetch(14) }
|
22
|
+
describe '#created' do
|
23
|
+
it 'returns a Time when updated is set' do
|
24
|
+
expect(vehicle.created).to be_a Time
|
25
|
+
end
|
26
|
+
end
|
27
|
+
describe '#edited' do
|
28
|
+
it 'returns a Time when edited is set' do
|
29
|
+
expect(vehicle.edited).to be_a Time
|
30
|
+
end
|
31
|
+
end
|
32
|
+
describe '#name' do
|
33
|
+
it 'should have the correct value' do
|
34
|
+
expect(vehicle.name).to eq 'Snowspeeder'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
describe '#model' do
|
38
|
+
it 'should have the correct value' do
|
39
|
+
expect(vehicle.model).to eq 't-47 airspeeder'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
describe '#manufacturer' do
|
43
|
+
it 'should have the correct value' do
|
44
|
+
expect(vehicle.manufacturer).to eq 'Incom corporation'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
describe '#vehicle_class' do
|
48
|
+
it 'should have the correct value' do
|
49
|
+
expect(vehicle.vehicle_class).to eq 'airspeeder'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
describe '#consumables' do
|
53
|
+
it 'should have the correct value' do
|
54
|
+
expect(vehicle.consumables).to eq 'none'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
describe '#cost_in_credits' do
|
58
|
+
it 'should should have the correct value' do
|
59
|
+
expect(vehicle.cost_in_credits).to eq 'unknown'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
describe '#length' do
|
63
|
+
it 'should be an integer' do
|
64
|
+
expect(vehicle.length).to be_an Float
|
65
|
+
end
|
66
|
+
it 'should should have the correct value' do
|
67
|
+
expect(vehicle.length).to eq 4.5
|
68
|
+
end
|
69
|
+
end
|
70
|
+
describe '#max_atmosphering_speed' do
|
71
|
+
it 'should be an integer' do
|
72
|
+
expect(vehicle.max_atmosphering_speed).to be_an Integer
|
73
|
+
end
|
74
|
+
it 'should should have the correct value' do
|
75
|
+
expect(vehicle.max_atmosphering_speed).to eq 650
|
76
|
+
end
|
77
|
+
end
|
78
|
+
describe '#crew' do
|
79
|
+
it 'should be an integer' do
|
80
|
+
expect(vehicle.crew).to be_an Integer
|
81
|
+
end
|
82
|
+
it 'should should have the correct value' do
|
83
|
+
expect(vehicle.crew).to eq 2
|
84
|
+
end
|
85
|
+
end
|
86
|
+
describe '#passengers' do
|
87
|
+
it 'should be an integer' do
|
88
|
+
expect(vehicle.passengers).to be_an Integer
|
89
|
+
end
|
90
|
+
it 'should should have the correct value' do
|
91
|
+
expect(vehicle.passengers).to eq 0
|
92
|
+
end
|
93
|
+
end
|
94
|
+
describe '#cargo_capacity' do
|
95
|
+
it 'should be an integer' do
|
96
|
+
expect(vehicle.cargo_capacity).to be_an Integer
|
97
|
+
end
|
98
|
+
it 'should should have the correct value' do
|
99
|
+
expect(vehicle.cargo_capacity).to eq 10
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe '#films' do
|
104
|
+
it 'should return an Array' do
|
105
|
+
expect(vehicle.films).to be_an Array
|
106
|
+
end
|
107
|
+
it 'should should the correct number of films' do
|
108
|
+
expect(vehicle.films.size).to eq 1
|
109
|
+
end
|
110
|
+
it 'should contain an array of films correctly parsed' do
|
111
|
+
film = vehicle.films.first
|
112
|
+
expect(film).to be_a Starwars::Film
|
113
|
+
expect(film.url).to eq 'http://swapi.co/api/films/2/'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
describe '#pilots' do
|
117
|
+
it 'should return an Array' do
|
118
|
+
expect(vehicle.pilots).to be_an Array
|
119
|
+
end
|
120
|
+
it 'should should the correct number of pilots' do
|
121
|
+
expect(vehicle.pilots.size).to eq 2
|
122
|
+
end
|
123
|
+
it 'should contain an array of pilots correctly parsed' do
|
124
|
+
person = vehicle.pilots.first
|
125
|
+
expect(person).to be_a Starwars::Person
|
126
|
+
expect(person.url).to eq 'http://swapi.co/api/people/1/'
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|