Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b0765016
Commit
b0765016
authored
Jul 01, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for todo_target_state_pill
- Issue, MR, Alert specs
parent
f22ded76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
spec/helpers/todos_helper_spec.rb
spec/helpers/todos_helper_spec.rb
+57
-0
No files found.
spec/helpers/todos_helper_spec.rb
View file @
b0765016
...
...
@@ -163,4 +163,61 @@ RSpec.describe TodosHelper do
expect
(
design_option
).
to
include
(
text:
'Design'
)
end
end
describe
'#todo_target_state_pill'
do
subject
{
helper
.
todo_target_state_pill
(
todo
)
}
shared_examples
'a rendered state pill'
do
|
atrr
|
it
'returns expected html'
do
html
=
"<span class=
\"
target-status
\"
><span class=
\"
status-box status-box-
#{
atrr
[
:type
]
}
-
#{
atrr
[
:state
].
dasherize
}
\"
>
#{
atrr
[
:state
].
capitalize
}
</span></span>"
expect
(
subject
).
to
eql
(
html
)
end
end
shared_examples
'no state pill'
do
specify
{
expect
(
subject
).
to
eq
(
nil
)
}
end
context
'merge request todo'
do
let
(
:todo
)
{
create
(
:todo
,
target:
create
(
:merge_request
))
}
it_behaves_like
'no state pill'
context
'merged MR'
do
before
do
todo
.
target
.
update!
(
state:
'merged'
)
end
it_behaves_like
'a rendered state pill'
,
type:
'mr'
,
state:
'merged'
end
end
context
'issue todo'
do
let
(
:todo
)
{
create
(
:todo
,
target:
issue
)
}
it_behaves_like
'no state pill'
context
'closed issue'
do
before
do
todo
.
target
.
update!
(
state:
'closed'
)
end
it_behaves_like
'a rendered state pill'
,
type:
'issue'
,
state:
'closed'
end
end
context
'alert todo'
do
let
(
:todo
)
{
alert_todo
}
it_behaves_like
'no state pill'
context
'resolved alert'
do
before
do
todo
.
target
.
resolve!
end
it_behaves_like
'a rendered state pill'
,
type:
'alert'
,
state:
'resolved'
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