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
Jérome Perrin
gitlab-ce
Commits
db5ea013
Commit
db5ea013
authored
Sep 25, 2014
by
Ciro Santilli
Committed by
Dmitriy Zaporozhets
Oct 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use :message key, not :error for File::Service.
parent
a54d5dc7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
11 deletions
+42
-11
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+1
-1
app/controllers/projects/edit_tree_controller.rb
app/controllers/projects/edit_tree_controller.rb
+1
-1
app/services/files/base_service.rb
app/services/files/base_service.rb
+0
-6
features/project/source/browse_files.feature
features/project/source/browse_files.feature
+20
-0
features/steps/project/source/browse_files.rb
features/steps/project/source/browse_files.rb
+8
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+9
-0
lib/api/files.rb
lib/api/files.rb
+3
-3
No files found.
app/controllers/projects/blob_controller.rb
View file @
db5ea013
...
...
@@ -20,7 +20,7 @@ class Projects::BlobController < Projects::ApplicationController
flash
[
:notice
]
=
"Your changes have been successfully committed"
redirect_to
project_tree_path
(
@project
,
@ref
)
else
flash
[
:alert
]
=
result
[
:
error
]
flash
[
:alert
]
=
result
[
:
message
]
render
:show
end
end
...
...
app/controllers/projects/edit_tree_controller.rb
View file @
db5ea013
...
...
@@ -22,7 +22,7 @@ class Projects::EditTreeController < Projects::BaseTreeController
redirect_to
after_edit_path
else
flash
[
:alert
]
=
result
[
:
error
]
flash
[
:alert
]
=
result
[
:
message
]
render
:show
end
end
...
...
app/services/files/base_service.rb
View file @
db5ea013
...
...
@@ -10,12 +10,6 @@ module Files
private
def
success
out
=
super
()
out
[
:error
]
=
''
out
end
def
repository
project
.
repository
end
...
...
features/project/source/browse_files.feature
View file @
db5ea013
...
...
@@ -34,6 +34,16 @@ Feature: Project Source Browse Files
Then
I am redirected to the new file
And
I should see its new content
@javascript
Scenario
:
If I enter an illegal file name I see an error message
Given
I click on
"new file"
link in repo
And
I fill the new file name with an illegal name
And
I edit code
And
I fill the commit message
And
I click on
"Commit changes"
Then
I am on the new file page
And
I see a commit error message
@javascript
Scenario
:
I
can edit file
Given
I click on
".gitignore"
file in repo
...
...
@@ -50,6 +60,16 @@ Feature: Project Source Browse Files
Then
I am redirected to the
".gitignore"
And
I should see its new content
@javascript
@wip
Scenario
:
If I don't change the content of the file I see an error message
Given
I click on
".gitignore"
file in repo
And
I click button
"edit"
And
I fill the commit message
And
I click on
"Commit changes"
# Test fails because carriage returns are added to the file.
Then
I am on the
".gitignore"
edit file page
And
I see a commit error message
@javascript
Scenario
:
I
can see editing preview
Given
I click on
".gitignore"
file in repo
...
...
features/steps/project/source/browse_files.rb
View file @
db5ea013
...
...
@@ -61,6 +61,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
fill_in
:file_name
,
with:
new_file_name
end
step
'I fill the new file name with an illegal name'
do
fill_in
:file_name
,
with:
'.git'
end
step
'I fill the commit message'
do
fill_in
:commit_message
,
with:
'Not yet a commit message.'
end
...
...
@@ -151,6 +155,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
expect
(
page
).
not_to
have_link
(
'permalink'
)
end
step
'I see a commit error message'
do
expect
(
page
).
to
have_content
(
'Your changes could not be committed'
)
end
private
def
set_new_content
...
...
features/steps/shared/paths.rb
View file @
db5ea013
...
...
@@ -265,6 +265,15 @@ module SharedPaths
visit
project_blob_path
(
@project
,
File
.
join
(
root_ref
,
'.gitignore'
))
end
step
'I am on the new file page'
do
current_path
.
should
eq
(
project_new_tree_path
(
@project
,
root_ref
))
end
step
'I am on the ".gitignore" edit file page'
do
current_path
.
should
eq
(
project_edit_tree_path
(
@project
,
File
.
join
(
root_ref
,
'.gitignore'
)))
end
step
'I visit project source page for "6d39438"'
do
visit
project_tree_path
(
@project
,
"6d39438"
)
end
...
...
lib/api/files.rb
View file @
db5ea013
...
...
@@ -85,7 +85,7 @@ module API
branch_name:
branch_name
}
else
render_api_error!
(
result
[
:
error
],
400
)
render_api_error!
(
result
[
:
message
],
400
)
end
end
...
...
@@ -117,7 +117,7 @@ module API
branch_name:
branch_name
}
else
render_api_error!
(
result
[
:
error
],
400
)
render_api_error!
(
result
[
:
message
],
400
)
end
end
...
...
@@ -149,7 +149,7 @@ module API
branch_name:
branch_name
}
else
render_api_error!
(
result
[
:
error
],
400
)
render_api_error!
(
result
[
:
message
],
400
)
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