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
09e1faa8
Commit
09e1faa8
authored
Nov 04, 2016
by
Ruben Davila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for new Slash commands: /estimate & /spend
parent
0140e7aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
spec/services/notes/slash_commands_service_spec.rb
spec/services/notes/slash_commands_service_spec.rb
+12
-0
spec/services/slash_commands/interpret_service_spec.rb
spec/services/slash_commands/interpret_service_spec.rb
+27
-1
No files found.
spec/services/notes/slash_commands_service_spec.rb
View file @
09e1faa8
...
...
@@ -84,6 +84,18 @@ describe Notes::SlashCommandsService, services: true do
expect
(
note
.
noteable
).
to
be_open
end
end
describe
'/spend'
do
let
(
:note_text
)
{
'/spend 1h'
}
it
'updates the spent time on the noteable'
do
content
,
command_params
=
service
.
extract_commands
(
note
)
service
.
execute
(
command_params
,
note
)
expect
(
content
).
to
eq
''
expect
(
note
.
noteable
.
time_spent
).
to
eq
(
3600
)
end
end
end
describe
'note with command & text'
do
...
...
spec/services/slash_commands/interpret_service_spec.rb
View file @
09e1faa8
...
...
@@ -210,6 +210,22 @@ describe SlashCommands::InterpretService, services: true do
end
end
shared_examples
'estimate command'
do
it
'populates time_estimate: "3600" if content contains /estimate 1h'
do
_
,
updates
=
service
.
execute
(
content
,
issuable
)
expect
(
updates
).
to
eq
(
time_estimate:
3600
)
end
end
shared_examples
'spend command'
do
it
'populates time_spent: "3600" if content contains /spend 1h'
do
_
,
updates
=
service
.
execute
(
content
,
issuable
)
expect
(
updates
).
to
eq
(
time_spent:
3600
)
end
end
shared_examples
'empty command'
do
it
'populates {} if content contains an unsupported command'
do
_
,
updates
=
service
.
execute
(
content
,
issuable
)
...
...
@@ -321,7 +337,7 @@ describe SlashCommands::InterpretService, services: true do
it_behaves_like
'multiple label with same argument'
do
let
(
:content
)
{
%(/label ~"#{inprogress.title}" \n/label ~#{inprogress.title})
}
let
(
:issuable
)
{
issue
}
end
end
it_behaves_like
'unlabel command'
do
let
(
:content
)
{
%(/unlabel ~"#{inprogress.title}")
}
...
...
@@ -500,6 +516,16 @@ describe SlashCommands::InterpretService, services: true do
let
(
:content
)
{
'/remove_due_date'
}
let
(
:issuable
)
{
issue
}
end
it_behaves_like
'estimate command'
do
let
(
:content
)
{
'/estimate 1h'
}
let
(
:issuable
)
{
issue
}
end
it_behaves_like
'spend command'
do
let
(
:content
)
{
'/spend 1h'
}
let
(
:issuable
)
{
issue
}
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