Skip to content

Commit eff60e6

Browse files
committed
updated comments in tests + updated assertions for new endpoint
1 parent 35a2d0b commit eff60e6

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/test.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ def app
1616
@app = SpacexAPI
1717
end
1818

19+
##########################################
20+
# Tests all endpoints for correct number
21+
# of JSON responses with predefined
22+
# data + predictible responses
23+
##########################################
24+
1925
def test_home_response
2026
get "/"
2127
assert last_response.ok?
@@ -27,23 +33,20 @@ def test_info_response
2733
get "/info"
2834
assert last_response.ok?
2935
data = JSON.parse(last_response.body)
30-
# Test out some data that is unlikely to ever change
3136
assert data.count > 0
3237
end
3338

3439
def test_latest_response
3540
get "/launches/latest"
3641
assert last_response.ok?
3742
data = JSON.parse(last_response.body)
38-
# Test out some data that is unlikely to ever change
39-
assert data.count > 0
43+
assert data.count == 1
4044
end
4145

4246
def test_launchpads_response
4347
get "/launchpads"
4448
assert last_response.ok?
4549
data = JSON.parse(last_response.body)
46-
# Make sure we got at least one launchpad back
4750
assert data.count > 0
4851
end
4952

@@ -86,7 +89,6 @@ def test_launches_response
8689
get "/launches"
8790
assert last_response.ok?
8891
data = JSON.parse(last_response.body)
89-
#make sure at least 1 launch is returned
9092
assert data.count > 0
9193
end
9294

@@ -107,8 +109,8 @@ def test_launches_year_response
107109
def test_launches_date_response
108110
get "/launches?from=2011-01-20&to=2013-05-25"
109111
assert last_response.ok?
110-
#data = JSON.parse(last_response.body)
111-
#assert data.count == 3
112+
data = JSON.parse(last_response.body)
113+
assert data.count == 3
112114
end
113115

114116
def test_caps_response

0 commit comments

Comments
 (0)