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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0f7d3f59
Commit
0f7d3f59
authored
Dec 15, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving repositories spec to roles. Added missing spec for project
parent
120f50cf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
98 deletions
+101
-98
app/views/merge_requests/show/_mr_box.html.haml
app/views/merge_requests/show/_mr_box.html.haml
+5
-1
app/views/merge_requests/show/_mr_title.html.haml
app/views/merge_requests/show/_mr_title.html.haml
+0
-5
spec/models/project_spec.rb
spec/models/project_spec.rb
+8
-91
spec/roles/repository_spec.rb
spec/roles/repository_spec.rb
+88
-1
No files found.
app/views/merge_requests/show/_mr_box.html.haml
View file @
0f7d3f59
.main_box
.main_box
.top_box_content
.top_box_content
%h4
.box-title
%h4
.box-title
-
if
@merge_request
.
closed
-
if
@merge_request
.
merged
.error.status_info
%i
.icon-ok
Merged
-
elsif
@merge_request
.
closed
.error.status_info
Closed
.error.status_info
Closed
=
gfm
escape_once
(
@merge_request
.
title
)
=
gfm
escape_once
(
@merge_request
.
title
)
...
...
app/views/merge_requests/show/_mr_title.html.haml
View file @
0f7d3f59
...
@@ -6,11 +6,6 @@
...
@@ -6,11 +6,6 @@
%span
.label_branch
=
@merge_request
.
target_branch
%span
.label_branch
=
@merge_request
.
target_branch
%span
.right
%span
.right
-
if
@merge_request
.
merged?
%span
.btn.small.disabled.grouped.success
%strong
%i
.icon-ok
=
"MERGED"
-
if
can?
(
current_user
,
:modify_merge_request
,
@merge_request
)
-
if
can?
(
current_user
,
:modify_merge_request
,
@merge_request
)
-
if
@merge_request
.
open?
-
if
@merge_request
.
open?
.left.btn-group
.left.btn-group
...
...
spec/models/project_spec.rb
View file @
0f7d3f59
...
@@ -129,6 +129,13 @@ describe Project do
...
@@ -129,6 +129,13 @@ describe Project do
it
{
should
respond_to
(
:execute_hooks
)
}
it
{
should
respond_to
(
:execute_hooks
)
}
it
{
should
respond_to
(
:post_receive_data
)
}
it
{
should
respond_to
(
:post_receive_data
)
}
it
{
should
respond_to
(
:trigger_post_receive
)
}
it
{
should
respond_to
(
:trigger_post_receive
)
}
# Namespaced Project Role
it
{
should
respond_to
(
:transfer
)
}
it
{
should
respond_to
(
:name_with_namespace
)
}
it
{
should
respond_to
(
:namespace_owner
)
}
it
{
should
respond_to
(
:chief
)
}
it
{
should
respond_to
(
:path_with_namespace
)
}
end
end
describe
'modules'
do
describe
'modules'
do
...
@@ -136,6 +143,7 @@ describe Project do
...
@@ -136,6 +143,7 @@ describe Project do
it
{
should
include_module
(
PushObserver
)
}
it
{
should
include_module
(
PushObserver
)
}
it
{
should
include_module
(
Authority
)
}
it
{
should
include_module
(
Authority
)
}
it
{
should
include_module
(
Team
)
}
it
{
should
include_module
(
Team
)
}
it
{
should
include_module
(
NamespacedProject
)
}
end
end
it
"should return valid url to repo"
do
it
"should return valid url to repo"
do
...
@@ -153,18 +161,6 @@ describe Project do
...
@@ -153,18 +161,6 @@ describe Project do
project
.
web_url
.
should
==
"
#{
Gitlab
.
config
.
url
}
/somewhere"
project
.
web_url
.
should
==
"
#{
Gitlab
.
config
.
url
}
/somewhere"
end
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
describe
"last_activity methods"
do
describe
"last_activity methods"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:last_event
)
{
double
(
created_at:
Time
.
now
)
}
let
(
:last_event
)
{
double
(
created_at:
Time
.
now
)
}
...
@@ -188,85 +184,6 @@ describe Project do
...
@@ -188,85 +184,6 @@ describe Project do
end
end
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
"Git methods"
do
let
(
:project
)
{
create
(
:project
)
}
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
end
describe
:update_merge_requests
do
describe
:update_merge_requests
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
...
...
spec/roles/repository_spec.rb
View file @
0f7d3f59
require
'spec_helper'
require
'spec_helper'
describe
Project
,
"Repository"
do
describe
Project
,
"Repository"
do
let
(
:project
)
{
build
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
describe
"#empty_repo?"
do
describe
"#empty_repo?"
do
it
"should return true if the repo doesn't exist"
do
it
"should return true if the repo doesn't exist"
do
...
@@ -69,4 +69,91 @@ describe Project, "Repository" do
...
@@ -69,4 +69,91 @@ describe Project, "Repository" do
project
.
root_ref?
(
'stable'
).
should
be_false
project
.
root_ref?
(
'stable'
).
should
be_false
end
end
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
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