Commit 78405b0e authored by John E. Vincent's avatar John E. Vincent

tests for new json index page

parent b5d80c3b
...@@ -2,12 +2,23 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') ...@@ -2,12 +2,23 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Noah App Basics", :reset_redis => true do describe "Noah App Basics", :reset_redis => true do
it "should show the index page" do it "should show the index page as html" do
header "Accept", "text/html"
get '/' get '/'
last_response.should be_ok last_response.should be_ok
last_response.body.include?("Noah Start Page").should == true last_response.body.include?("Noah Start Page").should == true
end end
it "should show the index page as json" do
header "Accept", "application/json"
get '/'
last_response.should return_json
response = JSON.parse(last_response.body)
response.has_key?("redis_version").should == true
response.has_key?("noah_version").should == true
response.has_key?("resources").should == true
end
it "should test the 404 message" do it "should test the 404 message" do
get '/foo' get '/foo'
last_response.status.should == 404 last_response.status.should == 404
......
{ {
"redis_verion":"<%= locals[:redis_version] %>", "redis_version":"<%= locals[:redis_version] %>",
"noah_version":"<%= locals[:noah_version] %>", "noah_version":"<%= locals[:noah_version] %>",
"resources":{ "resources":{
"hosts":{"link":"<%= request.url %>hosts"} "hosts":{"link":"<%= request.url %>hosts"},
"services":{"link":"<%= request.url %>services"} "services":{"link":"<%= request.url %>services"},
"applications":{"link":"<%= request.url %>applications"} "applications":{"link":"<%= request.url %>applications"},
"configurations":{"link":"<%= request.url %>configurations"} "configurations":{"link":"<%= request.url %>configurations"}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment