Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f8e1f4a7
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,发现更多精彩内容 >>
提交
f8e1f4a7
编写于
1月 14, 2013
作者:
R
Riyad Preukschas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace commit note request specs with spinach features
上级
30227869
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
145 addition
and
100 deletion
+145
-100
features/project/commits/commit_comments.feature
features/project/commits/commit_comments.feature
+42
-4
features/steps/project/comments_on_commits.rb
features/steps/project/comments_on_commits.rb
+2
-2
features/steps/shared/note.rb
features/steps/shared/note.rb
+99
-6
spec/requests/notes_on_commits_spec.rb
spec/requests/notes_on_commits_spec.rb
+2
-88
未找到文件。
features/project/commits/commit_comments.feature
浏览文件 @
f8e1f4a7
Feature
:
Project Comment commit
Feature
:
Comments on commits
Background
:
Given
I sign in as a user
And
I own project
"Shop"
Given
I visit project commit page
And
I visit project commit page
@javascript
Scenario
:
I
c
omment
commit
Scenario
:
I
c
an comment on a
commit
Given
I leave a comment like
"XML attached"
Then
I should see comment
"XML attached"
Then
I should see a comment saying
"XML attached"
@javascript
Scenario
:
I
can't cancel the main form
Then
I should not see the cancel comment button
@javascript
Scenario
:
I
can't preview without text
Given
I haven't written any comment text
Then
I should not see the comment preview button
@javascript
Scenario
:
I
can preview with text
Given
I write a comment like
"Nice"
Then
I should see the comment preview button
@javascript
Scenario
:
I
preview a comment
Given I preview a comment text like "Bug fixed
:
smile
:
"
Then
I should see the comment preview
And
I should not see the comment text field
@javascript
Scenario
:
I
can edit after preview
Given I preview a comment text like "Bug fixed
:
smile
:
"
Then
I should see the comment edit button
@javascript
Scenario
:
I
have a reset form after posting from preview
Given I preview a comment text like "Bug fixed
:
smile
:
"
And
I submit the comment
Then
I should see an empty comment text field
And
I should not see the comment preview
@javascript
Scenario
:
I
can delete a comment
Given
I leave a comment like
"XML attached"
And
I delete a comment
Then
I should not see a comment saying
"XML attached"
features/steps/project/
project_comment_commit
.rb
→
features/steps/project/
comments_on_commits
.rb
浏览文件 @
f8e1f4a7
class
ProjectCommentCommit
<
Spinach
::
FeatureSteps
class
CommentsOnCommits
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedNote
include
SharedPaths
include
SharedProject
end
features/steps/shared/note.rb
浏览文件 @
f8e1f4a7
module
SharedNote
include
Spinach
::
DSL
Given
'I delete a comment'
do
first
(
".js-note-delete"
).
trigger
(
"click"
)
end
Given
'I haven\'t written any comment text'
do
within
(
".js-main-target-form"
)
do
fill_in
"note[note]"
,
with:
""
end
end
Given
'I leave a comment like "XML attached"'
do
fill_in
"note_note"
,
:with
=>
"XML attached"
click_button
"Add Comment"
within
(
".js-main-target-form"
)
do
fill_in
"note[note]"
,
with:
"XML attached"
click_button
"Add Comment"
end
end
Then
'I should see comment "XML attached"'
do
page
.
should
have_content
"XML attached"
Given
'I preview a comment text like "Bug fixed :smile:"'
do
within
(
".js-main-target-form"
)
do
fill_in
"note[note]"
,
with:
"Bug fixed :smile:"
find
(
".js-note-preview-button"
).
trigger
(
"click"
)
end
end
Given
'I submit the comment'
do
within
(
".js-main-target-form"
)
do
click_button
"Add Comment"
end
end
Given
'I write a comment like "Nice"'
do
within
(
".js-main-target-form"
)
do
fill_in
"note[note]"
,
with:
"Nice"
end
end
Then
'I should not see a comment saying "XML attached"'
do
page
.
should_not
have_css
(
".note"
)
end
Then
'I should not see the cancel comment button'
do
within
(
".js-main-target-form"
)
do
should_not
have_link
(
"Cancel"
)
end
end
Then
'I should not see the comment preview'
do
within
(
".js-main-target-form"
)
do
page
.
should
have_css
(
".js-note-preview"
,
visible:
false
)
end
end
Then
'I should not see the comment preview button'
do
within
(
".js-main-target-form"
)
do
page
.
should
have_css
(
".js-note-preview-button"
,
visible:
false
)
end
end
Then
'I should not see the comment text field'
do
within
(
".js-main-target-form"
)
do
page
.
should
have_css
(
".js-note-text"
,
visible:
false
)
end
end
Then
'I should see a comment saying "XML attached"'
do
within
(
".note"
)
do
page
.
should
have_content
(
"XML attached"
)
end
end
Then
'I should see an empty comment text field'
do
within
(
".js-main-target-form"
)
do
page
.
should
have_field
(
"note[note]"
,
with:
""
)
end
end
Then
'I should see the comment edit button'
do
within
(
".js-main-target-form"
)
do
page
.
should
have_css
(
".js-note-edit-button"
,
visible:
true
)
end
end
Then
'I should see the comment preview'
do
within
(
".js-main-target-form"
)
do
page
.
should
have_css
(
".js-note-preview"
,
visible:
true
)
end
end
Then
'I should see the comment preview button'
do
within
(
".js-main-target-form"
)
do
page
.
should
have_css
(
".js-note-preview-button"
,
visible:
true
)
end
end
# Wall
Given
'I write new comment "my special test message"'
do
fill_in
"note_note"
,
:with
=>
"my special test message"
click_button
"Add Comment"
within
(
".js-main-target-form"
)
do
fill_in
"note[note]"
,
with:
"my special test message"
click_button
"Add Comment"
end
end
Then
'I should see project wall note "my special test message"'
do
...
...
spec/requests/notes_on_commits_spec.rb
浏览文件 @
f8e1f4a7
require
'spec_helper'
describe
"On a commit"
,
js:
true
do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:commit
)
{
project
.
commit
(
"bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
)
}
before
do
login_as
:user
project
.
add_access
(
@user
,
:read
,
:write
)
visit
project_commit_path
(
project
,
commit
)
end
subject
{
page
}
describe
"the note form"
do
# main target form creation
it
{
should
have_css
(
".js-main-target-form"
,
visible:
true
,
count:
1
)
}
# button initalization
it
{
within
(
".js-main-target-form"
)
{
should
have_button
(
"Add Comment"
)
}
}
it
{
within
(
".js-main-target-form"
)
{
should_not
have_link
(
"Cancel"
)
}
}
# notifiactions
it
{
within
(
".js-main-target-form"
)
{
should
have_unchecked_field
(
"Project team"
)
}
}
it
{
within
(
".js-main-target-form"
)
{
should
have_checked_field
(
"Commit author"
)
}
}
describe
"without text"
do
it
{
within
(
".js-main-target-form"
)
{
should
have_css
(
".js-note-preview-button"
,
visible:
false
)
}
}
end
describe
"with text"
do
before
do
within
(
".js-main-target-form"
)
do
fill_in
"note[note]"
,
with:
"This is awesome"
end
end
it
{
within
(
".js-main-target-form"
)
{
should_not
have_css
(
".js-comment-button[disabled]"
)
}
}
it
{
within
(
".js-main-target-form"
)
{
should
have_css
(
".js-note-preview-button"
,
visible:
true
)
}
}
end
describe
"with preview"
do
before
do
within
(
".js-main-target-form"
)
do
fill_in
"note[note]"
,
with:
"This is awesome"
find
(
".js-note-preview-button"
).
trigger
(
"click"
)
end
end
it
{
within
(
".js-main-target-form"
)
{
should
have_css
(
".js-note-preview"
,
text:
"This is awesome"
,
visible:
true
)
}
}
it
{
within
(
".js-main-target-form"
)
{
should
have_css
(
".js-note-preview-button"
,
visible:
false
)
}
}
it
{
within
(
".js-main-target-form"
)
{
should
have_css
(
".js-note-edit-button"
,
visible:
true
)
}
}
end
end
describe
"when posting a note"
do
before
do
within
(
".js-main-target-form"
)
do
fill_in
"note[note]"
,
with:
"This is awsome!"
find
(
".js-note-preview-button"
).
trigger
(
"click"
)
click_button
"Add Comment"
end
end
# note added
it
{
within
(
".js-main-target-form"
)
{
should
have_content
(
"This is awsome!"
)
}
}
# reset form
it
{
within
(
".js-main-target-form"
)
{
should
have_no_field
(
"note[note]"
,
with:
"This is awesome!"
)
}
}
# return from preview
it
{
within
(
".js-main-target-form"
)
{
should
have_css
(
".js-note-preview"
,
visible:
false
)
}
}
it
{
within
(
".js-main-target-form"
)
{
should
have_css
(
".js-note-text"
,
visible:
true
)
}
}
it
"should be removable"
do
find
(
".js-note-delete"
).
trigger
(
"click"
)
should_not
have_css
(
".note"
)
end
end
end
describe
"On a commit diff"
,
js:
true
do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:commit
)
{
project
.
commit
(
"bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
)
}
let!
(
:commit
)
{
project
.
repository
.
commit
(
"bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
)
}
before
do
login_as
:user
project
.
add_access
(
@user
,
:read
,
:write
)
project
.
team
<<
[
@user
,
:reporter
]
visit
project_commit_path
(
project
,
commit
)
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录