Skip to content

Commit

Permalink
added endpoint, test, corrected typo for falcon 1 data
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewmeyer committed Jul 17, 2017
1 parent 32689aa commit fe19547
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
require 'date'
require 'mysql2'
require './data/company_info.rb'
require './data/falcon1.rb'
require './data/falcon9.rb'
require './data/home_info.rb'
require './data/falcon_heavy.rb'
Expand Down Expand Up @@ -64,7 +65,12 @@ def hash_merge(*hashes)

get '/vehicles' do
content_type :json
JSON.pretty_generate([$falcon9, $falcon_heavy, $dragon])
JSON.pretty_generate([$falcon1, $falcon9, $falcon_heavy, $dragon])
end

get '/vehicles/falcon1' do
content_type :json
JSON.pretty_generate($falcon1)
end

get '/vehicles/falcon9' do
Expand Down
2 changes: 1 addition & 1 deletion data/falcon_1.rb → data/falcon1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@
}
}
},
description: 'Falcon 9 is a two-stage rocket designed and manufactured by SpaceX for the reliable and safe transport of satellites and the Dragon spacecraft into orbit.'
description: 'The Falcon 1 was an expendable launch system privately developed and manufactured by SpaceX during 2006–2009. On 28 September 2008, Falcon 1 became the first privately-developed liquid-fuel launch vehicle to go into orbit around the Earth.'
}
7 changes: 7 additions & 0 deletions test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ def test_vehicle_response
assert data.count > 0
end

def test_falcon1_response
get "/vehicles/falcon1"
assert last_response.ok?
data = JSON.parse(last_response.body)
assert data.count > 0
end

def test_falcon9_response
get "/vehicles/falcon9"
assert last_response.ok?
Expand Down

0 comments on commit fe19547

Please sign in to comment.