Skip to content

Commit 103aebc

Browse files
committed
corrected all tests for new namespace endpoints
1 parent 82b2d00 commit 103aebc

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

test/test.rb

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
require_relative '../app'
44
require 'json'
55

6-
module Rack
7-
module Test
8-
DEFAULT_HOST = 'api.example.org'.freeze
9-
end
10-
end
11-
126
class AppTest < Test::Unit::TestCase
137
include Rack::Test::Methods
148

@@ -23,104 +17,104 @@ def app
2317
##########################################
2418

2519
def test_home
26-
get '/'
20+
get '/api/v1/'
2721
assert last_response.ok?
2822
data = JSON.parse(last_response.body)
2923
assert data.count > 0
3024
end
3125

3226
def test_info
33-
get '/info'
27+
get '/api/v1/info'
3428
assert last_response.ok?
3529
data = JSON.parse(last_response.body)
3630
assert data.count > 0
3731
end
3832

3933
def test_latest
40-
get '/launches/latest'
34+
get '/api/v1/launches/latest'
4135
assert last_response.ok?
4236
data = JSON.parse(last_response.body)
4337
assert data.count == 1
4438
end
4539

4640
def test_launchpads
47-
get '/launchpads'
41+
get '/api/v1/launchpads'
4842
assert last_response.ok?
4943
data = JSON.parse(last_response.body)
5044
assert data.count > 0
5145
end
5246

5347
def test_vehicle
54-
get '/vehicles'
48+
get '/api/v1/vehicles'
5549
assert last_response.ok?
5650
data = JSON.parse(last_response.body)
5751
assert data.count > 0
5852
end
5953

6054
def test_falcon1
61-
get '/vehicles/falcon1'
55+
get '/api/v1/vehicles/falcon1'
6256
assert last_response.ok?
6357
data = JSON.parse(last_response.body)
6458
assert data.count > 0
6559
end
6660

6761
def test_falcon9
68-
get '/vehicles/falcon9'
62+
get '/api/v1/vehicles/falcon9'
6963
assert last_response.ok?
7064
data = JSON.parse(last_response.body)
7165
assert data.count > 0
7266
end
7367

7468
def test_falconheavy
75-
get '/vehicles/falconheavy'
69+
get '/api/v1/vehicles/falconheavy'
7670
assert last_response.ok?
7771
data = JSON.parse(last_response.body)
7872
assert data.count > 0
7973
end
8074

8175
def test_dragon
82-
get '/vehicles/dragon'
76+
get '/api/v1/vehicles/dragon'
8377
assert last_response.ok?
8478
data = JSON.parse(last_response.body)
8579
assert data.count > 0
8680
end
8781

8882
def test_launches
89-
get '/launches'
83+
get '/api/v1/launches'
9084
assert last_response.ok?
9185
data = JSON.parse(last_response.body)
9286
assert data.count > 0
9387
end
9488

9589
def test_upcoming
96-
get '/launches/upcoming'
90+
get '/api/v1/launches/upcoming'
9791
assert last_response.ok?
9892
data = JSON.parse(last_response.body)
9993
assert data.count > 0
10094
end
10195

10296
def test_launches_year
103-
get '/launches?year=2010'
97+
get '/api/v1/launches?year=2010'
10498
assert last_response.ok?
10599
assert last_response.body.include?('2010')
106100
end
107101

108102
def test_launches_date
109-
get '/launches?from=2011-01-20&to=2013-05-25'
103+
get '/api/v1/launches?from=2011-01-20&to=2013-05-25'
110104
assert last_response.ok?
111105
data = JSON.parse(last_response.body)
112106
assert data.count == 3
113107
end
114108

115109
def test_caps
116-
get '/parts/caps'
110+
get '/api/v1/parts/caps'
117111
assert last_response.ok?
118112
data = JSON.parse(last_response.body)
119113
assert data.count > 0
120114
end
121115

122116
def test_cores
123-
get '/parts/cores'
117+
get '/api/v1/parts/cores'
124118
assert last_response.ok?
125119
data = JSON.parse(last_response.body)
126120
assert data.count > 0

0 commit comments

Comments
 (0)