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
c65634cf
Commit
c65634cf
authored
Jun 19, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Error 500 when one user attempts to access a personal, internal snippet
Closes #1815
parent
d5cbdcc7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
2 deletions
+43
-2
CHANGELOG
CHANGELOG
+1
-0
app/models/ability.rb
app/models/ability.rb
+1
-1
features/snippets/snippets.feature
features/snippets/snippets.feature
+12
-1
features/steps/shared/authentication.rb
features/steps/shared/authentication.rb
+4
-0
features/steps/snippets/snippets.rb
features/steps/snippets/snippets.rb
+20
-0
spec/support/login_helpers.rb
spec/support/login_helpers.rb
+5
-0
No files found.
CHANGELOG
View file @
c65634cf
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 7.12.0 (unreleased)
v 7.12.0 (unreleased)
- Fix Error 500 when one user attempts to access a personal, internal snippet (Stan Hu)
- Update oauth button logos for Twitter and Google to recommended assets
- Update oauth button logos for Twitter and Google to recommended assets
- Update browser gem to version 0.8.0 for IE11 support (Stan Hu)
- Update browser gem to version 0.8.0 for IE11 support (Stan Hu)
- Fix timeout when rendering file with thousands of lines.
- Fix timeout when rendering file with thousands of lines.
...
...
app/models/ability.rb
View file @
c65634cf
...
@@ -263,7 +263,7 @@ class Ability
...
@@ -263,7 +263,7 @@ class Ability
:"modify_
#{
name
}
"
,
:"modify_
#{
name
}
"
,
]
]
else
else
if
subject
.
respond_to?
(
:project
)
if
subject
.
respond_to?
(
:project
)
&&
subject
.
project
project_abilities
(
user
,
subject
.
project
)
project_abilities
(
user
,
subject
.
project
)
else
else
[]
[]
...
...
features/snippets/snippets.feature
View file @
c65634cf
...
@@ -25,4 +25,15 @@ Feature: Snippets
...
@@ -25,4 +25,15 @@ Feature: Snippets
Scenario
:
I
destroy
"Personal snippet one"
Scenario
:
I
destroy
"Personal snippet one"
Given
I visit snippet page
"Personal snippet one"
Given
I visit snippet page
"Personal snippet one"
And
I click link
"Destroy"
And
I click link
"Destroy"
Then
I should not see
"Personal snippet one"
in snippets
Then
I should not see
"Personal snippet one"
in snippets
\ No newline at end of file
Scenario
:
I
create new internal snippet
Given
I logout directly
And
I sign in as an admin
Then
I visit new snippet page
And
I submit new internal snippet
Then
I visit snippet page
"Internal personal snippet one"
And
I logout directly
Then
I sign in as a user
Given
I visit new snippet page
Then
I visit snippet page
"Internal personal snippet one"
features/steps/shared/authentication.rb
View file @
c65634cf
...
@@ -28,6 +28,10 @@ module SharedAuthentication
...
@@ -28,6 +28,10 @@ module SharedAuthentication
logout
logout
end
end
step
"I logout directly"
do
logout_direct
end
def
current_user
def
current_user
@user
||
User
.
first
@user
||
User
.
first
end
end
...
...
features/steps/snippets/snippets.rb
View file @
c65634cf
...
@@ -31,6 +31,18 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
...
@@ -31,6 +31,18 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
click_button
"Create snippet"
click_button
"Create snippet"
end
end
step
'I submit new internal snippet'
do
fill_in
"personal_snippet_title"
,
:with
=>
"Internal personal snippet one"
fill_in
"personal_snippet_file_name"
,
:with
=>
"my_snippet.rb"
choose
'personal_snippet_visibility_level_10'
page
.
within
(
'.file-editor'
)
do
find
(
:xpath
,
"//input[@id='personal_snippet_content']"
).
set
'Content of internal snippet'
end
click_button
"Create snippet"
end
step
'I should see snippet "Personal snippet three"'
do
step
'I should see snippet "Personal snippet three"'
do
expect
(
page
).
to
have_content
"Personal snippet three"
expect
(
page
).
to
have_content
"Personal snippet three"
expect
(
page
).
to
have_content
"Content of snippet three"
expect
(
page
).
to
have_content
"Content of snippet three"
...
@@ -58,7 +70,15 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
...
@@ -58,7 +70,15 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
visit
snippet_path
(
snippet
)
visit
snippet_path
(
snippet
)
end
end
step
'I visit snippet page "Internal personal snippet one"'
do
visit
snippet_path
(
internal_snippet
)
end
def
snippet
def
snippet
@snippet
||=
PersonalSnippet
.
find_by!
(
title:
"Personal snippet one"
)
@snippet
||=
PersonalSnippet
.
find_by!
(
title:
"Personal snippet one"
)
end
end
def
internal_snippet
@snippet
||=
PersonalSnippet
.
find_by!
(
title:
"Internal personal snippet one"
)
end
end
end
spec/support/login_helpers.rb
View file @
c65634cf
...
@@ -23,4 +23,9 @@ module LoginHelpers
...
@@ -23,4 +23,9 @@ module LoginHelpers
def
logout
def
logout
find
(
:css
,
".fa.fa-sign-out"
).
click
find
(
:css
,
".fa.fa-sign-out"
).
click
end
end
# Logout without JavaScript driver
def
logout_direct
page
.
driver
.
submit
:delete
,
'/users/sign_out'
,
{}
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