Navigation Menu

Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
tests for new json index page
Browse files Browse the repository at this point in the history
  • Loading branch information
lusis committed Oct 9, 2011
1 parent b5d80c3 commit 78405b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
13 changes: 12 additions & 1 deletion spec/noahapp_spec.rb
Expand Up @@ -2,12 +2,23 @@

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 '/'
last_response.should be_ok
last_response.body.include?("Noah Start Page").should == true
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
get '/foo'
last_response.status.should == 404
Expand Down
8 changes: 4 additions & 4 deletions views/index.json.erb
@@ -1,10 +1,10 @@
{
"redis_verion":"<%= locals[:redis_version] %>",
"redis_version":"<%= locals[:redis_version] %>",
"noah_version":"<%= locals[:noah_version] %>",
"resources":{
"hosts":{"link":"<%= request.url %>hosts"}
"services":{"link":"<%= request.url %>services"}
"applications":{"link":"<%= request.url %>applications"}
"hosts":{"link":"<%= request.url %>hosts"},
"services":{"link":"<%= request.url %>services"},
"applications":{"link":"<%= request.url %>applications"},
"configurations":{"link":"<%= request.url %>configurations"}
}
}

0 comments on commit 78405b0

Please sign in to comment.