Skip to content

Commit 57c05e2

Browse files
Evan Brandtjakewmeyer
authored andcommitted
added 2 unit tests with assertions
1 parent d212025 commit 57c05e2

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/test.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require "test/unit"
22
require "rack/test"
33
require_relative '../app'
4+
require 'json'
45

56
module Rack
67
module Test
@@ -18,6 +19,23 @@ def app
1819
def test_response_is_ok
1920
get "/"
2021
assert last_response.ok?
21-
puts last_response.body
2222
end
23+
24+
def test_info_response
25+
get "/info"
26+
assert last_response.ok?
27+
data = JSON.parse(last_response.body)
28+
#test out some data that is unlikely to ever change
29+
assert data["name"] == "SpaceX"
30+
end
31+
32+
def test_launchpads_response
33+
get "/launchpads"
34+
assert last_response.ok?
35+
data = JSON.parse(last_response.body)
36+
#make sure we got at least one launchpad back
37+
assert data["launchpads"].count > 0
38+
end
39+
40+
2341
end

0 commit comments

Comments
 (0)