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
80a2b3f9
Commit
80a2b3f9
authored
Oct 08, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing tests for sinatra 1.3
parent
32f7ff12
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
26 deletions
+26
-26
configuration_spec.rb
spec/configuration_spec.rb
+4
-4
link_spec.rb
spec/link_spec.rb
+10
-10
noahapp_application_spec.rb
spec/noahapp_application_spec.rb
+1
-1
noahapp_service_spec.rb
spec/noahapp_service_spec.rb
+7
-7
noahapp_spec.rb
spec/noahapp_spec.rb
+1
-1
spec_helper.rb
spec/spec_helper.rb
+3
-3
No files found.
spec/configuration_spec.rb
View file @
80a2b3f9
...
...
@@ -65,8 +65,8 @@ describe "Using the Configuration Model", :reset_redis => true do
c
=
Noah
::
Configurations
.
all
c
.
class
.
to_s
.
should
==
'Hash'
c
.
size
.
should
==
2
c
.
has_key?
(
a
.
name
).
should
==
true
c
.
has_key?
(
b
.
name
).
should
==
true
c
.
has_key?
(
a
.
name
.
to_s
).
should
==
true
c
.
has_key?
(
b
.
name
.
to_s
).
should
==
true
end
it
"return all Configurations in short form"
do
...
...
@@ -75,8 +75,8 @@ describe "Using the Configuration Model", :reset_redis => true do
c
=
Noah
::
Configurations
.
all
({},
true
)
c
.
class
.
to_s
.
should
==
'Hash'
c
.
size
.
should
==
2
c
.
has_key?
(
a
.
name
).
should
==
true
c
.
has_key?
(
b
.
name
).
should
==
true
c
.
has_key?
(
a
.
name
.
to_s
).
should
==
true
c
.
has_key?
(
b
.
name
.
to_s
).
should
==
true
c
.
each
{
|
k
,
v
|
v
.
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
'created_at'
,
'format'
,
'updated_at'
]}
end
end
...
...
spec/link_spec.rb
View file @
80a2b3f9
...
...
@@ -58,16 +58,16 @@ describe "Using the Link Model", :reset_redis => true do
h
[
:name
].
should
==
l
.
name
h
[
:updated_at
].
should
==
l
.
updated_at
h
[
:created_at
].
should
==
l
.
created_at
h
[
:hosts
].
has_key?
(
@host
.
name
).
should
==
true
h
[
:hosts
][
@host
.
name
].
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
:id
,
:status
,
:tags
,
:services
].
map
{
|
k
|
k
.
to_s
}.
sort
h
[
:services
].
has_key?
(
@service
.
name
).
should
==
true
h
[
:services
][
@service
.
name
][
@host
.
name
].
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
:id
,
:status
,
:tags
].
map
{
|
k
|
k
.
to_s
}.
sort
h
[
:applications
].
has_key?
(
@application
.
name
).
should
==
true
h
[
:applications
][
@application
.
name
].
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
:id
,
:tags
,
:configurations
].
map
{
|
k
|
k
.
to_s
}.
sort
h
[
:configurations
].
has_key?
(
@configuration
.
name
).
should
==
true
h
[
:configurations
][
@configuration
.
name
].
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
:id
,
:tags
,
:format
,
:body
].
map
{
|
k
|
k
.
to_s
}.
sort
h
[
:ephemerals
].
has_key?
(
@ephemeral
.
name
).
should
==
true
h
[
:ephemerals
][
@ephemeral
.
name
].
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
:id
,
:tags
,
:path
,
:data
].
map
{
|
k
|
k
.
to_s
}.
sort
h
[
:hosts
].
has_key?
(
@host
.
name
.
to_s
).
should
==
true
h
[
:hosts
][
"
#{
@host
.
name
}
"
].
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
:id
,
:status
,
:tags
,
:services
].
map
{
|
k
|
k
.
to_s
}.
sort
h
[
:services
].
has_key?
(
@service
.
name
.
to_s
).
should
==
true
h
[
:services
][
"
#{
@service
.
name
}
"
][
"
#{
@host
.
name
}
"
].
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
:id
,
:status
,
:tags
].
map
{
|
k
|
k
.
to_s
}.
sort
h
[
:applications
].
has_key?
(
@application
.
name
.
to_s
).
should
==
true
h
[
:applications
][
"
#{
@application
.
name
}
"
].
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
:id
,
:tags
,
:configurations
].
map
{
|
k
|
k
.
to_s
}.
sort
h
[
:configurations
].
has_key?
(
@configuration
.
name
.
to_s
).
should
==
true
h
[
:configurations
][
"
#{
@configuration
.
name
}
"
].
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
:id
,
:tags
,
:format
,
:body
].
map
{
|
k
|
k
.
to_s
}.
sort
h
[
:ephemerals
].
has_key?
(
@ephemeral
.
name
.
to_s
).
should
==
true
h
[
:ephemerals
][
"
#{
@ephemeral
.
name
}
"
].
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
:id
,
:tags
,
:path
,
:data
].
map
{
|
k
|
k
.
to_s
}.
sort
end
end
...
...
spec/noahapp_application_spec.rb
View file @
80a2b3f9
...
...
@@ -27,7 +27,7 @@ describe "Using the Application API", :reset_redis => false do
response
[
"name"
].
should
==
@a
.
name
response
.
has_key?
(
"configurations"
).
should
==
true
c
=
response
[
"configurations"
]
c
.
has_key?
(
@c
.
name
).
should
==
true
c
.
has_key?
(
@c
.
name
.
to_s
).
should
==
true
c
[
"
#{
@c
.
name
}
"
][
"format"
].
should
==
"
#{
@c
.
format
}
"
c
[
"
#{
@c
.
name
}
"
][
"body"
].
should
==
"
#{
@c
.
body
}
"
end
...
...
spec/noahapp_service_spec.rb
View file @
80a2b3f9
...
...
@@ -22,13 +22,13 @@ describe "Using the Service API", :reset_redis => false, :populate_sample_data =
get
"/services/
#{
@sample_service
[
:name
]
}
"
last_response
.
should
be_ok
response
=
last_response
.
should
return_json
response
.
is_a?
(
Hash
).
should
==
true
response
.
has_key?
(
@s
.
name
).
should
==
true
response
[
@s
.
name
].
is_a?
(
Hash
).
should
==
true
response
[
@s
.
name
].
has_key?
(
@h
.
name
).
should
==
true
response
[
@s
.
name
][
@h
.
name
].
is_a?
(
Hash
).
should
==
true
response
[
@s
.
name
][
@h
.
name
][
"id"
].
should
==
@s
.
id
response
[
@s
.
name
][
@h
.
name
][
"status"
].
should
==
@s
.
status
response
.
class
.
to_s
.
should
==
"Hash"
response
.
has_key?
(
@s
.
name
.
to_s
).
should
==
true
response
[
"
#{
@s
.
name
}
"
].
class
.
to_s
.
should
==
"Hash"
response
[
"
#{
@s
.
name
}
"
].
has_key?
(
@h
.
name
.
to_s
).
should
==
true
response
[
"
#{
@s
.
name
}
"
][
"
#{
@h
.
name
}
"
].
class
.
to_s
.
should
==
"Hash"
response
[
"
#{
@s
.
name
}
"
][
"
#{
@h
.
name
}
"
][
"id"
].
should
==
@s
.
id
response
[
"
#{
@s
.
name
}
"
][
"
#{
@h
.
name
}
"
][
"status"
].
should
==
@s
.
status
end
it
"named service for host should work"
do
get
"/services/
#{
@sample_service
[
:name
]
}
/
#{
@sample_host
[
:name
]
}
"
...
...
spec/noahapp_spec.rb
View file @
80a2b3f9
...
...
@@ -11,7 +11,7 @@ describe "Noah App Basics", :reset_redis => true do
it
"should test the 404 message"
do
get
'/foo'
last_response
.
status
.
should
==
404
last_response
.
headers
[
"Content-Type"
].
should
==
"application/json"
last_response
.
should
return_json
response
=
JSON
.
parse
(
last_response
.
body
)
response
[
"result"
].
should
==
"failure"
response
[
"error_message"
].
should
==
"Resource not found"
...
...
spec/spec_helper.rb
View file @
80a2b3f9
...
...
@@ -72,7 +72,7 @@ end
RSpec
::
Matchers
.
define
:return_json
do
match
do
|
last_response
|
last_response
.
headers
[
"Content-Type"
].
should
=
=
"application/json"
last_response
.
headers
[
"Content-Type"
].
should
=
~
/^application\/json;.*/
response
=
JSON
.
parse
(
last_response
.
body
)
end
...
...
@@ -83,7 +83,7 @@ end
RSpec
::
Matchers
.
define
:be_missing
do
match
do
|
last_response
|
last_response
.
headers
[
"Content-Type"
].
should
=
=
"application/json"
last_response
.
headers
[
"Content-Type"
].
should
=
~
/^application\/json;.*/
last_response
.
status
.
should
==
404
response
=
JSON
.
parse
(
last_response
.
body
)
response
[
"result"
].
should
==
"failure"
...
...
@@ -93,7 +93,7 @@ end
RSpec
::
Matchers
.
define
:be_invalid
do
match
do
|
last_response
|
last_response
.
headers
[
"Content-Type"
].
should
=
=
"application/json"
last_response
.
headers
[
"Content-Type"
].
should
=
~
/^application\/json;.*/
response
=
JSON
.
parse
(
last_response
.
body
)
response
[
"result"
].
should
==
"failure"
response
[
"error_message"
].
should
==
"Missing Parameters"
...
...
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