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
f899b568
Commit
f899b568
authored
Aug 06, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
specs for configurations short form
parent
0a2d3d72
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
configuration_spec.rb
spec/configuration_spec.rb
+11
-0
noahapp_configuration_spec.rb
spec/noahapp_configuration_spec.rb
+28
-1
No files found.
spec/configuration_spec.rb
View file @
f899b568
...
@@ -68,6 +68,17 @@ describe "Using the Configuration Model", :reset_redis => true do
...
@@ -68,6 +68,17 @@ describe "Using the Configuration Model", :reset_redis => true do
c
.
has_key?
(
a
.
name
).
should
==
true
c
.
has_key?
(
a
.
name
).
should
==
true
c
.
has_key?
(
b
.
name
).
should
==
true
c
.
has_key?
(
b
.
name
).
should
==
true
end
end
it
"return all Configurations in short form"
do
a
=
Noah
::
Configuration
.
find_or_create
(
@appconf_string
)
b
=
Noah
::
Configuration
.
find_or_create
(
@appconf_json
)
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
.
each
{
|
k
,
v
|
v
.
keys
.
map
{
|
k
|
k
.
to_s
}.
sort
.
should
==
[
'created_at'
,
'format'
,
'updated_at'
]}
end
end
end
describe
"should not"
do
describe
"should not"
do
...
...
spec/noahapp_configuration_spec.rb
View file @
f899b568
...
@@ -41,7 +41,34 @@ describe "Using the Configuration API", :reset_redis => true, :populate_sample_d
...
@@ -41,7 +41,34 @@ describe "Using the Configuration API", :reset_redis => true, :populate_sample_d
end
end
end
end
end
end
it
"all configurations in short form"
it
"all configurations in short form with no trailing slash"
do
get
'/configurations?short=true'
last_response
.
should
be_ok
response
=
last_response
.
should
return_json
response
.
keys
.
size
.
should
==
3
%w[redis_url json_config yaml_config]
.
each
do
|
c
|
response
.
keys
.
member?
(
c
).
should
==
true
%w[format location created_at updated_at]
.
each
do
|
ck
|
response
[
c
].
keys
.
member?
(
ck
).
should
==
true
end
end
response
.
each
{
|
k
,
v
|
v
[
'location'
].
should
=~
/^http:\/\/.*\/configurations\/
#{
k
}
/
}
end
it
"all configurations in short form with trailing slash"
do
get
'/configurations/?short=true'
last_response
.
should
be_ok
response
=
last_response
.
should
return_json
response
.
keys
.
size
.
should
==
3
%w[redis_url json_config yaml_config]
.
each
do
|
c
|
response
.
keys
.
member?
(
c
).
should
==
true
%w[format location created_at updated_at]
.
each
do
|
ck
|
response
[
c
].
keys
.
member?
(
ck
).
should
==
true
end
end
response
.
each
{
|
k
,
v
|
v
[
'location'
].
should
=~
/^http:\/\/.*\/configurations\/
#{
k
}
/
}
end
it
"named configuration should work as JSON"
do
it
"named configuration should work as JSON"
do
header
"Accept"
,
"application/json"
header
"Accept"
,
"application/json"
...
...
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