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
iv
gitlab-ce
Commits
1ba28aae
Commit
1ba28aae
authored
Dec 22, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement UsersProject project_access validation
parent
640018ba
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
5 deletions
+8
-5
app/models/users_project.rb
app/models/users_project.rb
+1
-0
spec/factories.rb
spec/factories.rb
+1
-0
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+2
-2
spec/models/system_hook_spec.rb
spec/models/system_hook_spec.rb
+2
-2
spec/models/users_project_spec.rb
spec/models/users_project_spec.rb
+1
-0
spec/requests/gitlab_flavored_markdown_spec.rb
spec/requests/gitlab_flavored_markdown_spec.rb
+1
-1
No files found.
app/models/users_project.rb
View file @
1ba28aae
...
...
@@ -28,6 +28,7 @@ class UsersProject < ActiveRecord::Base
validates
:user
,
presence:
true
validates
:user_id
,
uniqueness:
{
:scope
=>
[
:project_id
],
message:
"already exists in project"
}
validates
:project_access
,
inclusion:
{
in:
[
GUEST
,
REPORTER
,
DEVELOPER
,
MASTER
]
},
presence:
true
validates
:project
,
presence:
true
delegate
:name
,
:email
,
to: :user
,
prefix:
true
...
...
spec/factories.rb
View file @
1ba28aae
...
...
@@ -45,6 +45,7 @@ FactoryGirl.define do
factory
:users_project
do
user
project
project_access
{
UsersProject
::
MASTER
}
end
factory
:issue
do
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
1ba28aae
...
...
@@ -85,7 +85,7 @@ describe GitlabMarkdownHelper do
let
(
:expected
)
{
project_team_member_path
(
project
,
member
)
}
before
do
project
.
users
<<
user
project
.
add_access
(
user
,
:admin
)
end
it
"should link using a simple name"
do
...
...
@@ -314,7 +314,7 @@ describe GitlabMarkdownHelper do
end
it
"should handle references in lists"
do
project
.
users
<<
user
project
.
add_access
(
user
,
:admin
)
actual
=
"
\n
* dark: #
#{
issue
.
id
}
\n
* light by @
#{
member
.
user
.
username
}
"
...
...
spec/models/system_hook_spec.rb
View file @
1ba28aae
...
...
@@ -56,7 +56,7 @@ describe SystemHook do
user
=
create
(
:user
)
project
=
create
(
:project
)
with_resque
do
project
.
users
<<
user
project
.
add_access
(
user
,
:admin
)
end
WebMock
.
should
have_requested
(
:post
,
@system_hook
.
url
).
with
(
body:
/user_add_to_team/
).
once
end
...
...
@@ -64,7 +64,7 @@ describe SystemHook do
it
"project_destroy hook"
do
user
=
create
(
:user
)
project
=
create
(
:project
)
project
.
users
<<
user
project
.
add_access
(
user
,
:admin
)
with_resque
do
project
.
users_projects
.
clear
end
...
...
spec/models/users_project_spec.rb
View file @
1ba28aae
...
...
@@ -29,6 +29,7 @@ describe UsersProject do
it
{
should
validate_uniqueness_of
(
:user_id
).
scoped_to
(
:project_id
).
with_message
(
/already exists/
)
}
it
{
should
validate_presence_of
(
:project
)
}
it
{
should
ensure_inclusion_of
(
:project_access
).
in_array
(
UsersProject
.
access_roles
.
values
)
}
end
describe
"Delegate methods"
do
...
...
spec/requests/gitlab_flavored_markdown_spec.rb
View file @
1ba28aae
...
...
@@ -6,7 +6,7 @@ describe "Gitlab Flavored Markdown" do
let
(
:merge_request
)
{
create
(
:merge_request
,
project:
project
)
}
let
(
:fred
)
do
u
=
create
(
:user
,
name:
"fred"
)
project
.
users
<<
u
project
.
add_access
(
u
,
:admin
)
u
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