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
afbdbb0c
Commit
afbdbb0c
authored
Jan 04, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rspec fixes
parent
dccd8b6e
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
149 additions
and
199 deletions
+149
-199
app/views/compare/_form.html.haml
app/views/compare/_form.html.haml
+1
-1
features/steps/project/project_browse_commits.rb
features/steps/project/project_browse_commits.rb
+2
-2
lib/api/notes.rb
lib/api/notes.rb
+2
-2
lib/api/projects.rb
lib/api/projects.rb
+3
-3
spec/controllers/commit_controller_spec.rb
spec/controllers/commit_controller_spec.rb
+2
-2
spec/controllers/commits_controller_spec.rb
spec/controllers/commits_controller_spec.rb
+1
-1
spec/controllers/merge_requests_controller_spec.rb
spec/controllers/merge_requests_controller_spec.rb
+1
-1
spec/controllers/tree_controller_spec.rb
spec/controllers/tree_controller_spec.rb
+1
-1
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+3
-3
spec/models/project_repository_spec.rb
spec/models/project_repository_spec.rb
+0
-159
spec/models/project_spec.rb
spec/models/project_spec.rb
+29
-9
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+89
-0
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+1
-1
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+1
-1
spec/requests/api/milestones_spec.rb
spec/requests/api/milestones_spec.rb
+1
-1
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+1
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+3
-3
spec/requests/atom/issues_spec.rb
spec/requests/atom/issues_spec.rb
+1
-1
spec/requests/gitlab_flavored_markdown_spec.rb
spec/requests/gitlab_flavored_markdown_spec.rb
+3
-3
spec/requests/projects_deploy_keys_spec.rb
spec/requests/projects_deploy_keys_spec.rb
+1
-1
spec/requests/search_spec.rb
spec/requests/search_spec.rb
+1
-1
spec/requests/snippets_spec.rb
spec/requests/snippets_spec.rb
+2
-2
No files found.
app/views/compare/_form.html.haml
View file @
afbdbb0c
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
:javascript
:javascript
$
(
function
()
{
$
(
function
()
{
var
availableTags
=
#{
@project
.
ref_names
.
to_json
}
;
var
availableTags
=
#{
@project
.
re
pository
.
re
f_names
.
to_json
}
;
$
(
"
#from, #to
"
).
autocomplete
({
$
(
"
#from, #to
"
).
autocomplete
({
source
:
availableTags
,
source
:
availableTags
,
...
...
features/steps/project/project_browse_commits.rb
View file @
afbdbb0c
...
@@ -4,7 +4,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
...
@@ -4,7 +4,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
include
SharedPaths
include
SharedPaths
Then
'I see project commits'
do
Then
'I see project commits'
do
commit
=
@project
.
commit
commit
=
@project
.
repository
.
commit
page
.
should
have_content
(
@project
.
name
)
page
.
should
have_content
(
@project
.
name
)
page
.
should
have_content
(
commit
.
message
)
page
.
should
have_content
(
commit
.
message
)
page
.
should
have_content
(
commit
.
id
.
to_s
[
0
..
5
])
page
.
should
have_content
(
commit
.
id
.
to_s
[
0
..
5
])
...
@@ -15,7 +15,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
...
@@ -15,7 +15,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps
end
end
Then
'I see commits atom feed'
do
Then
'I see commits atom feed'
do
commit
=
CommitDecorator
.
decorate
(
@project
.
commit
)
commit
=
CommitDecorator
.
decorate
(
@project
.
repository
.
commit
)
page
.
response_headers
[
'Content-Type'
].
should
have_content
(
"application/atom+xml"
)
page
.
response_headers
[
'Content-Type'
].
should
have_content
(
"application/atom+xml"
)
page
.
body
.
should
have_selector
(
"title"
,
:text
=>
"Recent commits to
#{
@project
.
name
}
"
)
page
.
body
.
should
have_selector
(
"title"
,
:text
=>
"Recent commits to
#{
@project
.
name
}
"
)
page
.
body
.
should
have_selector
(
"author email"
,
:text
=>
commit
.
author_email
)
page
.
body
.
should
have_selector
(
"author email"
,
:text
=>
commit
.
author_email
)
...
...
lib/api/notes.rb
View file @
afbdbb0c
...
@@ -13,7 +13,7 @@ module Gitlab
...
@@ -13,7 +13,7 @@ module Gitlab
# Example Request:
# Example Request:
# GET /projects/:id/notes
# GET /projects/:id/notes
get
":id/notes"
do
get
":id/notes"
do
@notes
=
user_project
.
common_notes
@notes
=
user_project
.
notes
.
common
present
paginate
(
@notes
),
with:
Entities
::
Note
present
paginate
(
@notes
),
with:
Entities
::
Note
end
end
...
@@ -25,7 +25,7 @@ module Gitlab
...
@@ -25,7 +25,7 @@ module Gitlab
# Example Request:
# Example Request:
# GET /projects/:id/notes/:note_id
# GET /projects/:id/notes/:note_id
get
":id/notes/:note_id"
do
get
":id/notes/:note_id"
do
@note
=
user_project
.
common_notes
.
find
(
params
[
:note_id
])
@note
=
user_project
.
notes
.
common
.
find
(
params
[
:note_id
])
present
@note
,
with:
Entities
::
Note
present
@note
,
with:
Entities
::
Note
end
end
...
...
lib/api/projects.rb
View file @
afbdbb0c
...
@@ -257,7 +257,7 @@ module Gitlab
...
@@ -257,7 +257,7 @@ module Gitlab
per_page
=
params
[
:per_page
]
||
20
per_page
=
params
[
:per_page
]
||
20
ref
=
params
[
:ref_name
]
||
user_project
.
try
(
:default_branch
)
||
'master'
ref
=
params
[
:ref_name
]
||
user_project
.
try
(
:default_branch
)
||
'master'
commits
=
user_project
.
commits
(
ref
,
nil
,
per_page
,
page
*
per_page
)
commits
=
user_project
.
repository
.
commits
(
ref
,
nil
,
per_page
,
page
*
per_page
)
present
CommitDecorator
.
decorate
(
commits
),
with:
Entities
::
RepoCommit
present
CommitDecorator
.
decorate
(
commits
),
with:
Entities
::
RepoCommit
end
end
...
@@ -375,10 +375,10 @@ module Gitlab
...
@@ -375,10 +375,10 @@ module Gitlab
ref
=
params
[
:sha
]
ref
=
params
[
:sha
]
commit
=
user_project
.
commit
ref
commit
=
user_project
.
repository
.
commit
ref
not_found!
"Commit"
unless
commit
not_found!
"Commit"
unless
commit
tree
=
Tree
.
new
commit
.
tree
,
user_project
,
ref
,
params
[
:filepath
]
tree
=
Tree
.
new
commit
.
tree
,
ref
,
params
[
:filepath
]
not_found!
"File"
unless
tree
.
try
(
:tree
)
not_found!
"File"
unless
tree
.
try
(
:tree
)
content_type
tree
.
mime_type
content_type
tree
.
mime_type
...
...
spec/controllers/commit_controller_spec.rb
View file @
afbdbb0c
...
@@ -3,12 +3,12 @@ require 'spec_helper'
...
@@ -3,12 +3,12 @@ require 'spec_helper'
describe
CommitController
do
describe
CommitController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
last_commit_for
(
"master"
)
}
let
(
:commit
)
{
project
.
repository
.
last_commit_for
(
"master"
)
}
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
project
.
add_access
(
user
,
:read
,
:admin
)
project
.
team
<<
[
user
,
:master
]
end
end
describe
"#show"
do
describe
"#show"
do
...
...
spec/controllers/commits_controller_spec.rb
View file @
afbdbb0c
...
@@ -7,7 +7,7 @@ describe CommitsController do
...
@@ -7,7 +7,7 @@ describe CommitsController do
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
project
.
add_access
(
user
,
:read
,
:admin
)
project
.
team
<<
[
user
,
:master
]
end
end
describe
"GET show"
do
describe
"GET show"
do
...
...
spec/controllers/merge_requests_controller_spec.rb
View file @
afbdbb0c
...
@@ -7,7 +7,7 @@ describe MergeRequestsController do
...
@@ -7,7 +7,7 @@ describe MergeRequestsController do
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
project
.
add_access
(
user
,
:read
,
:admin
)
project
.
team
<<
[
user
,
:master
]
MergeRequestsController
.
any_instance
.
stub
(
validates_merge_request:
true
)
MergeRequestsController
.
any_instance
.
stub
(
validates_merge_request:
true
)
end
end
...
...
spec/controllers/tree_controller_spec.rb
View file @
afbdbb0c
...
@@ -7,7 +7,7 @@ describe TreeController do
...
@@ -7,7 +7,7 @@ describe TreeController do
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
project
.
add_access
(
user
,
:read
,
:admin
)
project
.
team
<<
[
user
,
:master
]
project
.
stub
(
:branches
).
and_return
([
'master'
,
'foo/bar/baz'
])
project
.
stub
(
:branches
).
and_return
([
'master'
,
'foo/bar/baz'
])
project
.
stub
(
:tags
).
and_return
([
'v1.0.0'
,
'v2.0.0'
])
project
.
stub
(
:tags
).
and_return
([
'v1.0.0'
,
'v2.0.0'
])
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
afbdbb0c
...
@@ -4,7 +4,7 @@ describe GitlabMarkdownHelper do
...
@@ -4,7 +4,7 @@ describe GitlabMarkdownHelper do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
,
username:
'gfm'
)
}
let
(
:user
)
{
create
(
:user
,
username:
'gfm'
)
}
let
(
:commit
)
{
CommitDecorator
.
decorate
(
project
.
commit
)
}
let
(
:commit
)
{
CommitDecorator
.
decorate
(
project
.
repository
.
commit
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
project:
project
)
}
let
(
:snippet
)
{
create
(
:snippet
,
project:
project
)
}
let
(
:snippet
)
{
create
(
:snippet
,
project:
project
)
}
...
@@ -85,7 +85,7 @@ describe GitlabMarkdownHelper do
...
@@ -85,7 +85,7 @@ describe GitlabMarkdownHelper do
let
(
:expected
)
{
project_team_member_path
(
project
,
member
)
}
let
(
:expected
)
{
project_team_member_path
(
project
,
member
)
}
before
do
before
do
project
.
add_access
(
user
,
:admin
)
project
.
team
<<
[
user
,
:master
]
end
end
it
"should link using a simple name"
do
it
"should link using a simple name"
do
...
@@ -314,7 +314,7 @@ describe GitlabMarkdownHelper do
...
@@ -314,7 +314,7 @@ describe GitlabMarkdownHelper do
end
end
it
"should handle references in lists"
do
it
"should handle references in lists"
do
project
.
add_access
(
user
,
:admin
)
project
.
team
<<
[
user
,
:master
]
actual
=
"
\n
* dark: #
#{
issue
.
id
}
\n
* light by @
#{
member
.
user
.
username
}
"
actual
=
"
\n
* dark: #
#{
issue
.
id
}
\n
* light by @
#{
member
.
user
.
username
}
"
...
...
spec/models/project_repository_spec.rb
deleted
100644 → 0
View file @
dccd8b6e
require
'spec_helper'
describe
Project
,
"Repository"
do
let
(
:project
)
{
create
(
:project
)
}
describe
"#empty_repo?"
do
it
"should return true if the repo doesn't exist"
do
project
.
stub
(
repo_exists?:
false
,
has_commits?:
true
)
project
.
should
be_empty_repo
end
it
"should return true if the repo has commits"
do
project
.
stub
(
repo_exists?:
true
,
has_commits?:
false
)
project
.
should
be_empty_repo
end
it
"should return false if the repo exists and has commits"
do
project
.
stub
(
repo_exists?:
true
,
has_commits?:
true
)
project
.
should_not
be_empty_repo
end
end
describe
"#discover_default_branch"
do
let
(
:master
)
{
'master'
}
let
(
:stable
)
{
'stable'
}
it
"returns 'master' when master exists"
do
project
.
should_receive
(
:branch_names
).
at_least
(
:once
).
and_return
([
stable
,
master
])
project
.
discover_default_branch
.
should
==
'master'
end
it
"returns non-master when master exists but default branch is set to something else"
do
project
.
default_branch
=
'stable'
project
.
should_receive
(
:branch_names
).
at_least
(
:once
).
and_return
([
stable
,
master
])
project
.
discover_default_branch
.
should
==
'stable'
end
it
"returns a non-master branch when only one exists"
do
project
.
should_receive
(
:branch_names
).
at_least
(
:once
).
and_return
([
stable
])
project
.
discover_default_branch
.
should
==
'stable'
end
it
"returns nil when no branch exists"
do
project
.
should_receive
(
:branch_names
).
at_least
(
:once
).
and_return
([])
project
.
discover_default_branch
.
should
be_nil
end
end
describe
"#root_ref"
do
it
"returns default_branch when set"
do
project
.
default_branch
=
'stable'
project
.
root_ref
.
should
==
'stable'
end
it
"returns 'master' when default_branch is nil"
do
project
.
default_branch
=
nil
project
.
root_ref
.
should
==
'master'
end
end
describe
"#root_ref?"
do
it
"returns true when branch is root_ref"
do
project
.
default_branch
=
'stable'
project
.
root_ref?
(
'stable'
).
should
be_true
end
it
"returns false when branch is not root_ref"
do
project
.
default_branch
=
nil
project
.
root_ref?
(
'stable'
).
should
be_false
end
end
describe
:repo
do
it
"should return valid repo"
do
project
.
repo
.
should
be_kind_of
(
Grit
::
Repo
)
end
it
"should return nil"
do
lambda
{
Project
.
new
(
path:
"invalid"
).
repo
}.
should
raise_error
(
Grit
::
NoSuchPathError
)
end
it
"should return nil"
do
lambda
{
Project
.
new
.
repo
}.
should
raise_error
(
TypeError
)
end
end
describe
:commit
do
it
"should return first head commit if without params"
do
project
.
commit
.
id
.
should
==
project
.
repo
.
commits
.
first
.
id
end
it
"should return valid commit"
do
project
.
commit
(
ValidCommit
::
ID
).
should
be_valid_commit
end
it
"should return nil"
do
project
.
commit
(
"+123_4532530XYZ"
).
should
be_nil
end
end
describe
:tree
do
before
do
@commit
=
project
.
commit
(
ValidCommit
::
ID
)
end
it
"should raise error w/o arguments"
do
lambda
{
project
.
tree
}.
should
raise_error
end
it
"should return root tree for commit"
do
tree
=
project
.
tree
(
@commit
)
tree
.
contents
.
size
.
should
==
ValidCommit
::
FILES_COUNT
tree
.
contents
.
map
(
&
:name
).
should
==
ValidCommit
::
FILES
end
it
"should return root tree for commit with correct path"
do
tree
=
project
.
tree
(
@commit
,
ValidCommit
::
C_FILE_PATH
)
tree
.
contents
.
map
(
&
:name
).
should
==
ValidCommit
::
C_FILES
end
it
"should return root tree for commit with incorrect path"
do
project
.
tree
(
@commit
,
"invalid_path"
).
should
be_nil
end
end
describe
"fresh commits"
do
let
(
:project
)
{
create
(
:project
)
}
it
{
project
.
fresh_commits
(
3
).
count
.
should
==
3
}
it
{
project
.
fresh_commits
.
first
.
id
.
should
==
"bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
}
it
{
project
.
fresh_commits
.
last
.
id
.
should
==
"f403da73f5e62794a0447aca879360494b08f678"
}
end
describe
"commits_between"
do
let
(
:project
)
{
create
(
:project
)
}
subject
do
commits
=
project
.
commits_between
(
"3a4b4fb4cde7809f033822a171b9feae19d41fff"
,
"8470d70da67355c9c009e4401746b1d5410af2e3"
)
commits
.
map
{
|
c
|
c
.
id
}
end
it
{
should
have
(
3
).
elements
}
it
{
should
include
(
"f0f14c8eaba69ebddd766498a9d0b0e79becd633"
)
}
it
{
should_not
include
(
"bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
)
}
end
describe
:valid_repo?
do
it
"should be valid repo"
do
project
=
create
(
:project
)
project
.
valid_repo?
.
should
be_true
end
it
"should be invalid repo"
do
project
=
Project
.
new
(
name:
"ok_name"
,
path:
"/INVALID_PATH/"
,
path:
"NEOK"
)
project
.
valid_repo?
.
should
be_false
end
end
end
spec/models/project_spec.rb
View file @
afbdbb0c
...
@@ -84,7 +84,6 @@ describe Project do
...
@@ -84,7 +84,6 @@ describe Project do
it
{
should
respond_to
(
:satellite
)
}
it
{
should
respond_to
(
:satellite
)
}
it
{
should
respond_to
(
:update_repository
)
}
it
{
should
respond_to
(
:update_repository
)
}
it
{
should
respond_to
(
:destroy_repository
)
}
it
{
should
respond_to
(
:destroy_repository
)
}
it
{
should
respond_to
(
:archive_repo
)
}
# Authority Role
# Authority Role
it
{
should
respond_to
(
:reset_access
)
}
it
{
should
respond_to
(
:reset_access
)
}
...
@@ -94,14 +93,6 @@ describe Project do
...
@@ -94,14 +93,6 @@ describe Project do
it
{
should
respond_to
(
:dev_access_for?
)
}
it
{
should
respond_to
(
:dev_access_for?
)
}
it
{
should
respond_to
(
:master_access_for?
)
}
it
{
should
respond_to
(
:master_access_for?
)
}
# Team Role
it
{
should
respond_to
(
:team_member_by_name_or_email
)
}
it
{
should
respond_to
(
:team_member_by_id
)
}
it
{
should
respond_to
(
:add_user_to_team
)
}
it
{
should
respond_to
(
:add_users_to_team
)
}
it
{
should
respond_to
(
:add_user_id_to_team
)
}
it
{
should
respond_to
(
:add_users_ids_to_team
)
}
# Project Push Role
# Project Push Role
it
{
should
respond_to
(
:observe_push
)
}
it
{
should
respond_to
(
:observe_push
)
}
it
{
should
respond_to
(
:update_merge_requests
)
}
it
{
should
respond_to
(
:update_merge_requests
)
}
...
@@ -253,4 +244,33 @@ describe Project do
...
@@ -253,4 +244,33 @@ describe Project do
it
{
@project
.
to_param
.
should
==
"gitlab-ci"
}
it
{
@project
.
to_param
.
should
==
"gitlab-ci"
}
end
end
end
end
describe
"#empty_repo?"
do
let
(
:project
)
{
create
(
:project
)
}
it
"should return true if the repo doesn't exist"
do
project
.
stub
(
repo_exists?:
false
,
has_commits?:
true
)
project
.
should
be_empty_repo
end
it
"should return true if the repo has commits"
do
project
.
stub
(
repo_exists?:
true
,
has_commits?:
false
)
project
.
should
be_empty_repo
end
it
"should return false if the repo exists and has commits"
do
project
.
stub
(
repo_exists?:
true
,
has_commits?:
true
)
project
.
should_not
be_empty_repo
end
end
describe
:repository
do
it
"should return valid repo"
do
project
.
repository
.
should
be_kind_of
(
Repository
)
end
it
"should return nil"
do
Project
.
new
(
path:
"invalid"
).
repository
.
should
be_nil
end
end
end
end
spec/models/repository_spec.rb
View file @
afbdbb0c
describe
Repository
do
describe
Repository
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:repository
)
{
project
.
repository
}
describe
"Respond to"
do
describe
"Respond to"
do
subject
{
repository
}
it
{
should
respond_to
(
:repo
)
}
it
{
should
respond_to
(
:repo
)
}
it
{
should
respond_to
(
:tree
)
}
it
{
should
respond_to
(
:tree
)
}
it
{
should
respond_to
(
:root_ref
)
}
it
{
should
respond_to
(
:root_ref
)
}
...
@@ -11,4 +16,88 @@ describe Repository do
...
@@ -11,4 +16,88 @@ describe Repository do
it
{
should
respond_to
(
:commits_since
)
}
it
{
should
respond_to
(
:commits_since
)
}
it
{
should
respond_to
(
:commits_between
)
}
it
{
should
respond_to
(
:commits_between
)
}
end
end
describe
"#discover_default_branch"
do
let
(
:master
)
{
'master'
}
let
(
:stable
)
{
'stable'
}
it
"returns 'master' when master exists"
do
repository
.
should_receive
(
:branch_names
).
at_least
(
:once
).
and_return
([
stable
,
master
])
repository
.
discover_default_branch
.
should
==
'master'
end
it
"returns non-master when master exists but default branch is set to something else"
do
repository
.
default_branch
=
'stable'
repository
.
should_receive
(
:branch_names
).
at_least
(
:once
).
and_return
([
stable
,
master
])
repository
.
discover_default_branch
.
should
==
'stable'
end
it
"returns a non-master branch when only one exists"
do
repository
.
should_receive
(
:branch_names
).
at_least
(
:once
).
and_return
([
stable
])
repository
.
discover_default_branch
.
should
==
'stable'
end
it
"returns nil when no branch exists"
do
repository
.
should_receive
(
:branch_names
).
at_least
(
:once
).
and_return
([])
repository
.
discover_default_branch
.
should
be_nil
end
end
describe
:commit
do
it
"should return first head commit if without params"
do
repository
.
commit
.
id
.
should
==
repository
.
repo
.
commits
.
first
.
id
end
it
"should return valid commit"
do
repository
.
commit
(
ValidCommit
::
ID
).
should
be_valid_commit
end
it
"should return nil"
do
repository
.
commit
(
"+123_4532530XYZ"
).
should
be_nil
end
end
describe
:tree
do
before
do
@commit
=
repository
.
commit
(
ValidCommit
::
ID
)
end
it
"should raise error w/o arguments"
do
lambda
{
repository
.
tree
}.
should
raise_error
end
it
"should return root tree for commit"
do
tree
=
repository
.
tree
(
@commit
)
tree
.
contents
.
size
.
should
==
ValidCommit
::
FILES_COUNT
tree
.
contents
.
map
(
&
:name
).
should
==
ValidCommit
::
FILES
end
it
"should return root tree for commit with correct path"
do
tree
=
repository
.
tree
(
@commit
,
ValidCommit
::
C_FILE_PATH
)
tree
.
contents
.
map
(
&
:name
).
should
==
ValidCommit
::
C_FILES
end
it
"should return root tree for commit with incorrect path"
do
repository
.
tree
(
@commit
,
"invalid_path"
).
should
be_nil
end
end
describe
"fresh commits"
do
it
{
repository
.
fresh_commits
(
3
).
count
.
should
==
3
}
it
{
repository
.
fresh_commits
.
first
.
id
.
should
==
"bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
}
it
{
repository
.
fresh_commits
.
last
.
id
.
should
==
"f403da73f5e62794a0447aca879360494b08f678"
}
end
describe
"commits_between"
do
subject
do
commits
=
repository
.
commits_between
(
"3a4b4fb4cde7809f033822a171b9feae19d41fff"
,
"8470d70da67355c9c009e4401746b1d5410af2e3"
)
commits
.
map
{
|
c
|
c
.
id
}
end
it
{
should
have
(
3
).
elements
}
it
{
should
include
(
"f0f14c8eaba69ebddd766498a9d0b0e79becd633"
)
}
it
{
should_not
include
(
"bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
)
}
end
end
end
spec/requests/api/issues_spec.rb
View file @
afbdbb0c
...
@@ -6,7 +6,7 @@ describe Gitlab::API do
...
@@ -6,7 +6,7 @@ describe Gitlab::API do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:issue
)
{
create
(
:issue
,
author:
user
,
assignee:
user
,
project:
project
)
}
let!
(
:issue
)
{
create
(
:issue
,
author:
user
,
assignee:
user
,
project:
project
)
}
before
{
project
.
add_access
(
user
,
:read
)
}
before
{
project
.
team
<<
[
user
,
:reporter
]
}
describe
"GET /issues"
do
describe
"GET /issues"
do
context
"when unauthenticated"
do
context
"when unauthenticated"
do
...
...
spec/requests/api/merge_requests_spec.rb
View file @
afbdbb0c
...
@@ -6,7 +6,7 @@ describe Gitlab::API do
...
@@ -6,7 +6,7 @@ describe Gitlab::API do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
author:
user
,
assignee:
user
,
project:
project
,
title:
"Test"
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
author:
user
,
assignee:
user
,
project:
project
,
title:
"Test"
)
}
before
{
project
.
add_access
(
user
,
:read
)
}
before
{
project
.
team
<<
[
user
,
:reporters
]
}
describe
"GET /projects/:id/merge_requests"
do
describe
"GET /projects/:id/merge_requests"
do
context
"when unauthenticated"
do
context
"when unauthenticated"
do
...
...
spec/requests/api/milestones_spec.rb
View file @
afbdbb0c
...
@@ -7,7 +7,7 @@ describe Gitlab::API do
...
@@ -7,7 +7,7 @@ describe Gitlab::API do
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
before
{
project
.
add_access
(
user
,
:read
)
}
before
{
project
.
team
<<
[
user
,
:developer
]
}
describe
"GET /projects/:id/milestones"
do
describe
"GET /projects/:id/milestones"
do
it
"should return project milestones"
do
it
"should return project milestones"
do
...
...
spec/requests/api/notes_spec.rb
View file @
afbdbb0c
...
@@ -10,7 +10,7 @@ describe Gitlab::API do
...
@@ -10,7 +10,7 @@ describe Gitlab::API do
let!
(
:issue_note
)
{
create
(
:note
,
noteable:
issue
,
project:
project
,
author:
user
)
}
let!
(
:issue_note
)
{
create
(
:note
,
noteable:
issue
,
project:
project
,
author:
user
)
}
let!
(
:snippet_note
)
{
create
(
:note
,
noteable:
snippet
,
project:
project
,
author:
user
)
}
let!
(
:snippet_note
)
{
create
(
:note
,
noteable:
snippet
,
project:
project
,
author:
user
)
}
let!
(
:wall_note
)
{
create
(
:note
,
project:
project
,
author:
user
)
}
let!
(
:wall_note
)
{
create
(
:note
,
project:
project
,
author:
user
)
}
before
{
project
.
add_access
(
user
,
:read
)
}
before
{
project
.
team
<<
[
user
,
:reporter
]
}
describe
"GET /projects/:id/notes"
do
describe
"GET /projects/:id/notes"
do
context
"when unauthenticated"
do
context
"when unauthenticated"
do
...
...
spec/requests/api/projects_spec.rb
View file @
afbdbb0c
...
@@ -11,7 +11,7 @@ describe Gitlab::API do
...
@@ -11,7 +11,7 @@ describe Gitlab::API do
let!
(
:snippet
)
{
create
(
:snippet
,
author:
user
,
project:
project
,
title:
'example'
)
}
let!
(
:snippet
)
{
create
(
:snippet
,
author:
user
,
project:
project
,
title:
'example'
)
}
let!
(
:users_project
)
{
create
(
:users_project
,
user:
user
,
project:
project
,
project_access:
UsersProject
::
MASTER
)
}
let!
(
:users_project
)
{
create
(
:users_project
,
user:
user
,
project:
project
,
project_access:
UsersProject
::
MASTER
)
}
let!
(
:users_project2
)
{
create
(
:users_project
,
user:
user3
,
project:
project
,
project_access:
UsersProject
::
DEVELOPER
)
}
let!
(
:users_project2
)
{
create
(
:users_project
,
user:
user3
,
project:
project
,
project_access:
UsersProject
::
DEVELOPER
)
}
before
{
project
.
add_access
(
user
,
:read
)
}
before
{
project
.
team
<<
[
user
,
:reporter
]
}
describe
"GET /projects"
do
describe
"GET /projects"
do
context
"when unauthenticated"
do
context
"when unauthenticated"
do
...
@@ -226,14 +226,14 @@ describe Gitlab::API do
...
@@ -226,14 +226,14 @@ describe Gitlab::API do
describe
"GET /projects/:id/repository/commits"
do
describe
"GET /projects/:id/repository/commits"
do
context
"authorized user"
do
context
"authorized user"
do
before
{
project
.
add_access
(
user2
,
:read
)
}
before
{
project
.
team
<<
[
user2
,
:reporter
]
}
it
"should return project commits"
do
it
"should return project commits"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits"
,
user
)
response
.
status
.
should
==
200
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
should
be_an
Array
json_response
.
first
[
'id'
].
should
==
project
.
commit
.
id
json_response
.
first
[
'id'
].
should
==
project
.
repository
.
commit
.
id
end
end
end
end
...
...
spec/requests/atom/issues_spec.rb
View file @
afbdbb0c
...
@@ -6,7 +6,7 @@ describe "Issues Feed" do
...
@@ -6,7 +6,7 @@ describe "Issues Feed" do
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let!
(
:issue
)
{
create
(
:issue
,
author:
user
,
project:
project
)
}
let!
(
:issue
)
{
create
(
:issue
,
author:
user
,
project:
project
)
}
before
{
project
.
add_access
(
user
,
:read
,
:write
)
}
before
{
project
.
team
<<
[
user
,
:developer
]
}
context
"when authenticated"
do
context
"when authenticated"
do
it
"should render atom feed"
do
it
"should render atom feed"
do
...
...
spec/requests/gitlab_flavored_markdown_spec.rb
View file @
afbdbb0c
...
@@ -6,7 +6,7 @@ describe "Gitlab Flavored Markdown" do
...
@@ -6,7 +6,7 @@ describe "Gitlab Flavored Markdown" do
let
(
:merge_request
)
{
create
(
:merge_request
,
project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
project:
project
)
}
let
(
:fred
)
do
let
(
:fred
)
do
u
=
create
(
:user
,
name:
"fred"
)
u
=
create
(
:user
,
name:
"fred"
)
project
.
add_access
(
u
,
:admin
)
project
.
team
<<
[
u
,
:master
]
u
u
end
end
...
@@ -33,11 +33,11 @@ describe "Gitlab Flavored Markdown" do
...
@@ -33,11 +33,11 @@ describe "Gitlab Flavored Markdown" do
project
.
repo
.
gc_auto
project
.
repo
.
gc_auto
end
end
let
(
:commit
)
{
project
.
commits
(
@branch_name
).
first
}
let
(
:commit
)
{
project
.
repository
.
commits
(
@branch_name
).
first
}
before
do
before
do
login_as
:user
login_as
:user
project
.
add_access
(
@user
,
:read
,
:write
)
project
.
team
<<
[
@user
,
:developer
]
end
end
describe
"for commits"
do
describe
"for commits"
do
...
...
spec/requests/projects_deploy_keys_spec.rb
View file @
afbdbb0c
...
@@ -5,7 +5,7 @@ describe "Projects", "DeployKeys" do
...
@@ -5,7 +5,7 @@ describe "Projects", "DeployKeys" do
before
do
before
do
login_as
:user
login_as
:user
project
.
add_access
(
@user
,
:read
,
:write
,
:admin
)
project
.
team
<<
[
@user
,
:master
]
end
end
describe
"GET /keys"
do
describe
"GET /keys"
do
...
...
spec/requests/search_spec.rb
View file @
afbdbb0c
...
@@ -4,7 +4,7 @@ describe "Search" do
...
@@ -4,7 +4,7 @@ describe "Search" do
before
do
before
do
login_as
:user
login_as
:user
@project
=
create
(
:project
)
@project
=
create
(
:project
)
@project
.
add_access
(
@user
,
:read
)
@project
.
team
<<
[
@user
,
:reporter
]
visit
search_path
visit
search_path
fill_in
"search"
,
with:
@project
.
name
[
0
..
3
]
fill_in
"search"
,
with:
@project
.
name
[
0
..
3
]
click_button
"Search"
click_button
"Search"
...
...
spec/requests/snippets_spec.rb
View file @
afbdbb0c
...
@@ -5,7 +5,7 @@ describe "Snippets" do
...
@@ -5,7 +5,7 @@ describe "Snippets" do
before
do
before
do
login_as
:user
login_as
:user
project
.
add_access
(
@user
,
:read
,
:write
)
project
.
team
<<
[
@user
,
:developer
]
end
end
describe
"GET /snippets"
do
describe
"GET /snippets"
do
...
@@ -26,7 +26,7 @@ describe "Snippets" do
...
@@ -26,7 +26,7 @@ describe "Snippets" do
before
do
before
do
# admin access to remove snippet
# admin access to remove snippet
@user
.
users_projects
.
destroy_all
@user
.
users_projects
.
destroy_all
project
.
add_access
(
@user
,
:read
,
:write
,
:admin
)
project
.
team
<<
[
@user
,
:master
]
visit
edit_project_snippet_path
(
project
,
@snippet
)
visit
edit_project_snippet_path
(
project
,
@snippet
)
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