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
1a001230
Commit
1a001230
authored
Apr 11, 2011
by
John E. Vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finishing tag ruby api specs
parent
e08e9597
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
tag_spec.rb
spec/tag_spec.rb
+19
-4
No files found.
spec/tag_spec.rb
View file @
1a001230
...
@@ -8,7 +8,7 @@ describe "Using the Tag Model", :reset_redis => true do
...
@@ -8,7 +8,7 @@ describe "Using the Tag Model", :reset_redis => true do
@host
=
Noah
::
Host
.
create
(
:name
=>
'tagged_host'
,
:status
=>
'up'
)
@host
=
Noah
::
Host
.
create
(
:name
=>
'tagged_host'
,
:status
=>
'up'
)
@service
=
Noah
::
Service
.
create
(
:name
=>
'tagged_service'
,
:status
=>
'down'
,
:host_id
=>
@host
.
id
)
@service
=
Noah
::
Service
.
create
(
:name
=>
'tagged_service'
,
:status
=>
'down'
,
:host_id
=>
@host
.
id
)
@application
=
Noah
::
Application
.
create
(
:name
=>
'tagged_application'
)
@application
=
Noah
::
Application
.
create
(
:name
=>
'tagged_application'
)
@configuration
=
Noah
::
Configuration
.
create
(
:name
=>
'tagged_configuration'
)
@configuration
=
Noah
::
Configuration
.
create
(
:name
=>
'tagged_configuration'
,
:format
=>
'string'
,
:body
=>
'some_string'
)
@ephemeral
=
Noah
::
Ephemeral
.
create
(
:path
=>
'/tagged/ephemeral'
)
@ephemeral
=
Noah
::
Ephemeral
.
create
(
:path
=>
'/tagged/ephemeral'
)
end
end
after
(
:each
)
do
after
(
:each
)
do
...
@@ -47,15 +47,30 @@ describe "Using the Tag Model", :reset_redis => true do
...
@@ -47,15 +47,30 @@ describe "Using the Tag Model", :reset_redis => true do
end
end
Noah
::
Tag
.
all
.
size
.
should
==
3
Noah
::
Tag
.
all
.
size
.
should
==
3
end
end
it
"find all objects tagged"
it
"tag all object types and find via tagged"
do
it
"support tagging all object types"
[
@host
,
@service
,
@application
,
@configuration
,
@ephemeral
].
each
do
|
o
|
o
.
tag!
@tags1
end
@tags1
.
each
do
|
tag
|
Noah
::
Tag
.
tagged
(
tag
).
size
.
should
==
5
[
@host
,
@service
,
@application
,
@configuration
,
@ephemeral
].
each
do
|
o
|
Noah
::
Tag
.
tagged
(
tag
).
values
.
flatten
.
member?
(
o
.
name
).
should
==
true
end
end
end
end
end
describe
"should not"
do
describe
"should not"
do
it
"
should not
create a new Noah::Tag without a name"
do
it
"create a new Noah::Tag without a name"
do
a
=
Noah
::
Tag
.
create
a
=
Noah
::
Tag
.
create
a
.
valid?
.
should
==
false
a
.
valid?
.
should
==
false
a
.
errors
.
should
==
[[
:name
,
:not_present
]]
a
.
errors
.
should
==
[[
:name
,
:not_present
]]
end
end
it
"create a tag with a duplicate name"
do
a
=
Noah
::
Tag
.
create
(
:name
=>
'tag1'
)
b
=
Noah
::
Tag
.
create
(
:name
=>
'tag1'
)
b
.
valid?
.
should
==
false
b
.
errors
.
should
==
[[
:name
,
:not_unique
]]
end
end
end
end
end
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