Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f1235491
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f1235491
编写于
9月 08, 2016
作者:
S
Stan Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move write_note into SlashCommandsHelper and update other dependent specs
上级
65eadf98
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
21 deletion
+24
-21
spec/features/issues/user_uses_slash_commands_spec.rb
spec/features/issues/user_uses_slash_commands_spec.rb
+7
-8
spec/features/merge_requests/user_uses_slash_commands_spec.rb
.../features/merge_requests/user_uses_slash_commands_spec.rb
+6
-4
spec/support/issuable_slash_commands_shared_examples.rb
spec/support/issuable_slash_commands_shared_examples.rb
+1
-9
spec/support/slash_commands_helpers.rb
spec/support/slash_commands_helpers.rb
+10
-0
未找到文件。
spec/features/issues/user_uses_slash_commands_spec.rb
浏览文件 @
f1235491
require
'rails_helper'
feature
'Issues > User uses slash commands'
,
feature:
true
,
js:
true
do
include
SlashCommandsHelpers
include
WaitForAjax
it_behaves_like
'issuable record that supports slash commands in its description and notes'
,
:issue
do
...
...
@@ -17,14 +18,15 @@ feature 'Issues > User uses slash commands', feature: true, js: true do
visit
namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
end
after
do
wait_for_ajax
end
describe
'adding a due date from note'
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
it
'does not create a note, and sets the due date accordingly'
do
page
.
within
(
'.js-main-target-form'
)
do
fill_in
'note[note]'
,
with:
"/due 2016-08-28"
click_button
'Comment'
end
write_note
(
"/due 2016-08-28"
)
expect
(
page
).
not_to
have_content
'/due 2016-08-28'
expect
(
page
).
to
have_content
'Your commands have been executed!'
...
...
@@ -41,10 +43,7 @@ feature 'Issues > User uses slash commands', feature: true, js: true do
it
'does not create a note, and removes the due date accordingly'
do
expect
(
issue
.
due_date
).
to
eq
Date
.
new
(
2016
,
8
,
28
)
page
.
within
(
'.js-main-target-form'
)
do
fill_in
'note[note]'
,
with:
"/remove_due_date"
click_button
'Comment'
end
write_note
(
"/remove_due_date"
)
expect
(
page
).
not_to
have_content
'/remove_due_date'
expect
(
page
).
to
have_content
'Your commands have been executed!'
...
...
spec/features/merge_requests/user_uses_slash_commands_spec.rb
浏览文件 @
f1235491
require
'rails_helper'
feature
'Merge Requests > User uses slash commands'
,
feature:
true
,
js:
true
do
include
SlashCommandsHelpers
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
...
...
@@ -20,11 +21,12 @@ feature 'Merge Requests > User uses slash commands', feature: true, js: true do
visit
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
end
after
do
wait_for_ajax
end
it
'does not recognize the command nor create a note'
do
page
.
within
(
'.js-main-target-form'
)
do
fill_in
'note[note]'
,
with:
"/due 2016-08-28"
click_button
'Comment'
end
write_note
(
"/due 2016-08-28"
)
expect
(
page
).
not_to
have_content
'/due 2016-08-28'
end
...
...
spec/support/issuable_slash_commands_shared_examples.rb
浏览文件 @
f1235491
...
...
@@ -2,6 +2,7 @@
# It takes a `issuable_type`, and expect an `issuable`.
shared_examples
'issuable record that supports slash commands in its description and notes'
do
|
issuable_type
|
include
SlashCommandsHelpers
include
WaitForAjax
let
(
:master
)
{
create
(
:user
)
}
...
...
@@ -25,15 +26,6 @@ shared_examples 'issuable record that supports slash commands in its description
wait_for_ajax
end
def
write_note
(
text
)
Sidekiq
::
Testing
.
fake!
do
page
.
within
(
'.js-main-target-form'
)
do
fill_in
'note[note]'
,
with:
text
click_button
'Comment'
end
end
end
describe
"new
#{
issuable_type
}
"
do
context
'with commands in the description'
do
it
"creates the
#{
issuable_type
}
and interpret commands accordingly"
do
...
...
spec/support/slash_commands_helpers.rb
0 → 100644
浏览文件 @
f1235491
module
SlashCommandsHelpers
def
write_note
(
text
)
Sidekiq
::
Testing
.
fake!
do
page
.
within
(
'.js-main-target-form'
)
do
fill_in
'note[note]'
,
with:
text
click_button
'Comment'
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录