Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
Noah
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Noah
Commits
78405b0e
Commit
78405b0e
authored
Oct 08, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests for new json index page
parent
b5d80c3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
noahapp_spec.rb
spec/noahapp_spec.rb
+12
-1
index.json.erb
views/index.json.erb
+4
-4
No files found.
spec/noahapp_spec.rb
View file @
78405b0e
...
...
@@ -2,12 +2,23 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
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
...
...
views/index.json.erb
View file @
78405b0e
{
"redis_verion":"
<%=
locals
[
:redis_version
]
%>
",
"redis_ver
s
ion":"
<%=
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"}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment