Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f614ae8e
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f614ae8e
编写于
11月 21, 2012
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Increased test coverage
上级
e9be4b37
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
84 addition
and
42 deletion
+84
-42
app/views/projects/_clone_panel.html.haml
app/views/projects/_clone_panel.html.haml
+3
-3
app/views/snippets/_form.html.haml
app/views/snippets/_form.html.haml
+20
-20
features/support/env.rb
features/support/env.rb
+6
-1
spec/models/group_spec.rb
spec/models/group_spec.rb
+8
-0
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+42
-0
spec/spec_helper.rb
spec/spec_helper.rb
+5
-0
spec/support/namespaces_stub.rb
spec/support/namespaces_stub.rb
+0
-18
未找到文件。
app/views/projects/_clone_panel.html.haml
浏览文件 @
f614ae8e
...
...
@@ -6,12 +6,12 @@
.right
-
unless
@project
.
empty_repo?
-
if
can?
current_user
,
:download_code
,
@project
=
link_to
archive_project_repository_path
(
@project
),
class:
"btn grouped"
do
=
link_to
archive_project_repository_path
(
@project
),
class:
"btn
-small btn
grouped"
do
%i
.icon-download-alt
Download
-
if
@project
.
merge_requests_enabled
&&
can?
(
current_user
,
:write_merge_request
,
@project
)
=
link_to
new_project_merge_request_path
(
@project
),
title:
"New Merge Request"
,
class:
"btn grouped"
do
=
link_to
new_project_merge_request_path
(
@project
),
title:
"New Merge Request"
,
class:
"btn
-small btn
grouped"
do
Merge Request
-
if
@project
.
issues_enabled
&&
can?
(
current_user
,
:write_issue
,
@project
)
=
link_to
new_project_issue_path
(
@project
),
title:
"New Issue"
,
class:
"btn grouped"
do
=
link_to
new_project_issue_path
(
@project
),
title:
"New Issue"
,
class:
"btn
-small btn
grouped"
do
Issue
app/views/snippets/_form.html.haml
浏览文件 @
f614ae8e
%h3
=
@snippet
.
new_record?
?
"New Snippet"
:
"Edit Snippet #
#{
@snippet
.
id
}
"
%h3
.page_title
=
@snippet
.
new_record?
?
"New Snippet"
:
"Edit Snippet #
#{
@snippet
.
id
}
"
%hr
=
form_for
[
@project
,
@snippet
]
do
|
f
|
%table
.no-borders
-
if
@snippet
.
errors
.
any?
.alert-message.block-message.error
%ul
-
@snippet
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
-
if
@snippet
.
errors
.
any?
.alert-message.block-message.error
%ul
-
@snippet
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
.clearfix
=
f
.
label
:title
.input
=
f
.
text_field
:title
,
placeholder:
"Example Snippet"
.clearfix
=
f
.
label
:file_name
.input
=
f
.
text_field
:file_name
,
placeholder:
"example.rb"
.clearfix
=
f
.
label
"Lifetime"
.input
=
f
.
select
:expires_at
,
lifetime_select_options
,
{},
{
class:
'chosen span2'
}
.clearfix
=
f
.
label
:content
,
"Code"
.input
=
f
.
text_area
:content
,
class:
"span8"
.clearfix
=
f
.
label
:title
.input
=
f
.
text_field
:title
,
placeholder:
"Example Snippet"
.clearfix
=
f
.
label
:file_name
.input
=
f
.
text_field
:file_name
,
placeholder:
"example.rb"
.clearfix
=
f
.
label
"Lifetime"
.input
=
f
.
select
:expires_at
,
lifetime_select_options
,
{},
{
class:
'chosen span2'
}
.clearfix
=
f
.
label
:content
,
"Code"
.input
=
f
.
text_area
:content
,
class:
"span8"
.actions
.
form-
actions
=
f
.
submit
'Save'
,
class:
"primary btn"
=
link_to
"Cancel"
,
project_snippets_path
(
@project
),
class:
" btn"
-
unless
@snippet
.
new_record?
...
...
features/support/env.rb
浏览文件 @
f614ae8e
...
...
@@ -5,7 +5,7 @@ require 'rspec'
require
'database_cleaner'
require
'spinach/capybara'
%w(
namespaces_stub
gitolite_stub stubbed_repository valid_commit)
.
each
do
|
f
|
%w(gitolite_stub stubbed_repository valid_commit)
.
each
do
|
f
|
require
Rails
.
root
.
join
(
'spec'
,
'support'
,
f
)
end
...
...
@@ -32,6 +32,11 @@ end
DatabaseCleaner
.
strategy
=
:truncation
Spinach
.
hooks
.
before_scenario
do
# Use tmp dir for FS manipulations
Gitlab
.
config
.
stub
(
git_base_path:
Rails
.
root
.
join
(
'tmp'
,
'test-git-base-path'
))
FileUtils
.
rm_rf
Gitlab
.
config
.
git_base_path
FileUtils
.
mkdir_p
Gitlab
.
config
.
git_base_path
DatabaseCleaner
.
start
end
...
...
spec/models/group_spec.rb
浏览文件 @
f614ae8e
...
...
@@ -22,4 +22,12 @@ describe Group do
it
{
should
validate_presence_of
:path
}
it
{
should
validate_uniqueness_of
(
:path
)
}
it
{
should
validate_presence_of
:owner
}
describe
:users
do
it
{
group
.
users
.
should
==
[]
}
end
describe
:human_name
do
it
{
group
.
human_name
.
should
==
group
.
name
}
end
end
spec/models/namespace_spec.rb
浏览文件 @
f614ae8e
...
...
@@ -32,4 +32,46 @@ describe Namespace do
it
{
should
respond_to
(
:human_name
)
}
it
{
should
respond_to
(
:to_param
)
}
end
it
{
Namespace
.
global_id
.
should
==
'GLN'
}
describe
:to_param
do
it
{
namespace
.
to_param
.
should
==
namespace
.
path
}
end
describe
:human_name
do
it
{
namespace
.
human_name
.
should
==
namespace
.
owner_name
}
end
describe
:search
do
before
do
@namespace
=
create
:namespace
end
it
{
Namespace
.
search
(
@namespace
.
path
).
should
==
[
@namespace
]
}
it
{
Namespace
.
search
(
'unknown'
).
should
==
[]
}
end
describe
:move_dir
do
before
do
@namespace
=
create
:namespace
end
it
"should raise error when called directly"
do
expect
{
@namespace
.
move_dir
}.
to
raise_error
(
"Already exists"
)
end
it
"should move dir if path changed"
do
new_path
=
@namespace
.
path
+
"_new"
@namespace
.
stub
(
path_was:
@namespace
.
path
)
@namespace
.
stub
(
path:
new_path
)
@namespace
.
move_dir
.
should
be_true
end
end
describe
:rm_dir
do
it
"should remove dir"
do
namespace
.
rm_dir
.
should
be_true
end
end
end
spec/spec_helper.rb
浏览文件 @
f614ae8e
...
...
@@ -40,5 +40,10 @@ RSpec.configure do |config|
# !!! Observers disabled by default in tests
ActiveRecord
::
Base
.
observers
.
disable
(
:all
)
# ActiveRecord::Base.observers.enable(:all)
# Use tmp dir for FS manipulations
Gitlab
.
config
.
stub
(
git_base_path:
Rails
.
root
.
join
(
'tmp'
,
'test-git-base-path'
))
FileUtils
.
rm_rf
Gitlab
.
config
.
git_base_path
FileUtils
.
mkdir_p
Gitlab
.
config
.
git_base_path
end
end
spec/support/namespaces_stub.rb
已删除
100644 → 0
浏览文件 @
e9be4b37
require
'namespace'
require
'gitlab/project_mover'
class
Namespace
def
ensure_dir_exist
true
end
def
move_dir
true
end
end
#class Gitlab::ProjectMover
#def execute
#true
#end
#end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录