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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
2d842b61
Commit
2d842b61
authored
Sep 29, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:gitlabhq/gitlabhq
parents
221210a5
0a1176d6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
142 additions
and
23 deletions
+142
-23
app/views/projects/diffs/_file.html.haml
app/views/projects/diffs/_file.html.haml
+10
-9
db/fixtures/development/01_admin.rb
db/fixtures/development/01_admin.rb
+12
-10
db/fixtures/development/10_merge_requests.rb
db/fixtures/development/10_merge_requests.rb
+18
-0
features/project/source/browse_files.feature
features/project/source/browse_files.feature
+30
-0
features/steps/project/browse_files.rb
features/steps/project/browse_files.rb
+72
-4
No files found.
app/views/projects/diffs/_file.html.haml
View file @
2d842b61
...
@@ -15,12 +15,13 @@
...
@@ -15,12 +15,13 @@
%span
.file-mode
=
"
#{
diff_file
.
diff
.
a_mode
}
→
#{
diff_file
.
diff
.
b_mode
}
"
%span
.file-mode
=
"
#{
diff_file
.
diff
.
a_mode
}
→
#{
diff_file
.
diff
.
b_mode
}
"
.diff-btn-group
.diff-btn-group
-
if
blob
.
text?
-
unless
params
[
:view
]
==
'parallel'
-
unless
params
[
:view
]
==
'parallel'
%label
%label
=
check_box_tag
nil
,
1
,
false
,
class:
"js-toggle-diff-line-wrap"
=
check_box_tag
nil
,
1
,
false
,
class:
'js-toggle-diff-line-wrap'
Wrap text
Wrap text
=
link_to
"#"
,
class:
"js-toggle-diff-comments btn btn-small"
do
=
link_to
'#'
,
class:
'js-toggle-diff-comments btn btn-small'
do
%i
.icon-chevron-down
%i
.icon-chevron-down
Diff comments
Diff comments
...
...
db/fixtures/development/01_admin.rb
View file @
2d842b61
User
.
seed
do
|
s
|
Gitlab
::
Seeder
.
quiet
do
User
.
seed
do
|
s
|
s
.
id
=
1
s
.
id
=
1
s
.
name
=
"Administrator"
s
.
name
=
'Administrator'
s
.
email
=
"admin@example.com"
s
.
email
=
'admin@example.com'
s
.
username
=
'root'
s
.
username
=
'root'
s
.
password
=
"5iveL!fe"
s
.
password
=
'5iveL!fe'
s
.
password_confirmation
=
"5iveL!fe"
s
.
password_confirmation
=
'5iveL!fe'
s
.
admin
=
true
s
.
admin
=
true
s
.
projects_limit
=
100
s
.
projects_limit
=
100
s
.
confirmed_at
=
DateTime
.
now
s
.
confirmed_at
=
DateTime
.
now
end
end
end
db/fixtures/development/10_merge_requests.rb
View file @
2d842b61
...
@@ -20,4 +20,22 @@ Gitlab::Seeder.quiet do
...
@@ -20,4 +20,22 @@ Gitlab::Seeder.quiet do
print
'.'
print
'.'
end
end
end
end
project
=
Project
.
find_with_namespace
(
'gitlab-org/testme'
)
params
=
{
source_branch:
'feature'
,
target_branch:
'master'
,
title:
'Can be automatically merged'
}
MergeRequests
::
CreateService
.
new
(
project
,
User
.
admins
.
first
,
params
).
execute
print
'.'
params
=
{
source_branch:
'feature_conflict'
,
target_branch:
'feature'
,
title:
'Cannot be automatically merged'
}
MergeRequests
::
CreateService
.
new
(
project
,
User
.
admins
.
first
,
params
).
execute
print
'.'
end
end
features/project/source/browse_files.feature
View file @
2d842b61
...
@@ -24,12 +24,32 @@ Feature: Project Browse files
...
@@ -24,12 +24,32 @@ Feature: Project Browse files
Given
I click on
"new file"
link in repo
Given
I click on
"new file"
link in repo
Then
I can see new file page
Then
I can see new file page
@javascript
Scenario
:
I
can create and commit file
Given
I click on
"new file"
link in repo
And
I edit code
And
I fill the new file name
And
I fill the commit message
And
I click on
"Commit changes"
Then
I am redirected to the new file
And
I should see its new content
@javascript
@javascript
Scenario
:
I
can edit file
Scenario
:
I
can edit file
Given
I click on
".gitignore"
file in repo
Given
I click on
".gitignore"
file in repo
And
I click button
"edit"
And
I click button
"edit"
Then
I can edit code
Then
I can edit code
@javascript
Scenario
:
I
can edit and commit file
Given
I click on
".gitignore"
file in repo
And
I click button
"edit"
And
I edit code
And
I fill the commit message
And
I click on
"Commit changes"
Then
I am redirected to the
".gitignore"
And
I should see its new content
@javascript
@javascript
Scenario
:
I
can see editing preview
Scenario
:
I
can see editing preview
Given
I click on
".gitignore"
file in repo
Given
I click on
".gitignore"
file in repo
...
@@ -38,6 +58,16 @@ Feature: Project Browse files
...
@@ -38,6 +58,16 @@ Feature: Project Browse files
And
I click link
"Diff"
And
I click link
"Diff"
Then
I see diff
Then
I see diff
@javascript
Scenario
:
I
can remove file and commit
Given
I click on
".gitignore"
file in repo
And
I see the
".gitignore"
And
I click on
"remove"
And
I fill the commit message
And
I click on
"Remove file"
Then
I am redirected to the files URL
And
I don't see the
".gitignore"
Scenario
:
I
can browse directory with Browse Dir
Scenario
:
I
can browse directory with Browse Dir
Given
I click on files directory
Given
I click on files directory
And
I click on history link
And
I click on history link
...
...
features/steps/project/browse_files.rb
View file @
2d842b61
...
@@ -16,12 +16,24 @@ class Spinach::Features::ProjectBrowseFiles < Spinach::FeatureSteps
...
@@ -16,12 +16,24 @@ class Spinach::Features::ProjectBrowseFiles < Spinach::FeatureSteps
page
.
should
have_content
"LICENSE"
page
.
should
have_content
"LICENSE"
end
end
step
'I see the ".gitignore"'
do
page
.
should
have_content
'.gitignore'
end
step
'I don\'t see the ".gitignore"'
do
page
.
should_not
have_content
'.gitignore'
end
step
'I click on ".gitignore" file in repo'
do
step
'I click on ".gitignore" file in repo'
do
click_link
".gitignore"
click_link
".gitignore"
end
end
step
'I should see its content'
do
step
'I should see its content'
do
page
.
should
have_content
"*.rbc"
page
.
should
have_content
old_gitignore_content
end
step
'I should see its new content'
do
page
.
should
have_content
new_gitignore_content
end
end
step
'I click link "raw"'
do
step
'I click link "raw"'
do
...
@@ -37,18 +49,38 @@ class Spinach::Features::ProjectBrowseFiles < Spinach::FeatureSteps
...
@@ -37,18 +49,38 @@ class Spinach::Features::ProjectBrowseFiles < Spinach::FeatureSteps
end
end
step
'I can edit code'
do
step
'I can edit code'
do
execute_script
(
'editor.setValue("GitlabFileEditor")'
)
set_new_content
evaluate_script
(
'editor.getValue()'
).
should
==
"GitlabFileEditor"
evaluate_script
(
'editor.getValue()'
).
should
==
new_gitignore_content
end
end
step
'I edit code'
do
step
'I edit code'
do
execute_script
(
'editor.setValue("GitlabFileEditor")'
)
set_new_content
end
step
'I fill the new file name'
do
fill_in
:file_name
,
with:
new_file_name
end
step
'I fill the commit message'
do
fill_in
:commit_message
,
with:
'Not yet a commit message.'
end
end
step
'I click link "Diff"'
do
step
'I click link "Diff"'
do
click_link
'Diff'
click_link
'Diff'
end
end
step
'I click on "Commit changes"'
do
click_button
'Commit changes'
end
step
'I click on "remove"'
do
click_link
'remove'
end
step
'I click on "Remove file"'
do
click_button
'Remove file'
end
step
'I see diff'
do
step
'I see diff'
do
page
.
should
have_css
'.line_holder.new'
page
.
should
have_css
'.line_holder.new'
end
end
...
@@ -97,12 +129,48 @@ class Spinach::Features::ProjectBrowseFiles < Spinach::FeatureSteps
...
@@ -97,12 +129,48 @@ class Spinach::Features::ProjectBrowseFiles < Spinach::FeatureSteps
click_link
'permalink'
click_link
'permalink'
end
end
step
'I am redirected to the files URL'
do
current_path
.
should
==
project_tree_path
(
@project
,
'master'
)
end
step
'I am redirected to the ".gitignore"'
do
expect
(
current_path
).
to
eq
(
project_blob_path
(
@project
,
'master/.gitignore'
))
end
step
'I am redirected to the permalink URL'
do
step
'I am redirected to the permalink URL'
do
expect
(
current_path
).
to
eq
(
project_blob_path
(
expect
(
current_path
).
to
eq
(
project_blob_path
(
@project
,
@project
.
repository
.
commit
.
sha
+
'/.gitignore'
))
@project
,
@project
.
repository
.
commit
.
sha
+
'/.gitignore'
))
end
end
step
'I am redirected to the new file'
do
expect
(
current_path
).
to
eq
(
project_blob_path
(
@project
,
'master/'
+
new_file_name
))
end
step
"I don't see the permalink link"
do
step
"I don't see the permalink link"
do
expect
(
page
).
not_to
have_link
(
'permalink'
)
expect
(
page
).
not_to
have_link
(
'permalink'
)
end
end
private
def
set_new_content
execute_script
(
"editor.setValue('
#{
new_gitignore_content
}
')"
)
end
# Content of the gitignore file on the seed repository.
def
old_gitignore_content
'*.rbc'
end
# Constant value that differs from the content
# of the gitignore of the seed repository.
def
new_gitignore_content
old_gitignore_content
+
'a'
end
# Constant value that is a valid filename and
# not a filename present at root of the seed repository.
def
new_file_name
'not_a_file.md'
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