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
Léo-Paul Géneau
gitlab-ce
Commits
de89dcc2
Commit
de89dcc2
authored
Aug 11, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some codestyle changes and fixes for GitLab pages
parent
fff5ebdc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
+20
-10
app/models/project.rb
app/models/project.rb
+2
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+18
-9
No files found.
app/models/project.rb
View file @
de89dcc2
...
@@ -1222,7 +1222,8 @@ class Project < ActiveRecord::Base
...
@@ -1222,7 +1222,8 @@ class Project < ActiveRecord::Base
end
end
def
pages_path
def
pages_path
File
.
join
(
Settings
.
pages
.
path
,
disk_path
)
# TODO: when we migrate Pages to work with new storage types, change here to use disk_path
File
.
join
(
Settings
.
pages
.
path
,
full_path
)
end
end
def
public_pages_path
def
public_pages_path
...
...
spec/models/project_spec.rb
View file @
de89dcc2
...
@@ -2318,6 +2318,10 @@ describe Project do
...
@@ -2318,6 +2318,10 @@ describe Project do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:gitlab_shell
)
{
Gitlab
::
Shell
.
new
}
let
(
:gitlab_shell
)
{
Gitlab
::
Shell
.
new
}
before
do
allow
(
project
).
to
receive
(
:gitlab_shell
).
and_return
(
gitlab_shell
)
end
describe
'#base_dir'
do
describe
'#base_dir'
do
it
'returns base_dir based on namespace only'
do
it
'returns base_dir based on namespace only'
do
expect
(
project
.
base_dir
).
to
eq
(
project
.
namespace
.
full_path
)
expect
(
project
.
base_dir
).
to
eq
(
project
.
namespace
.
full_path
)
...
@@ -2331,10 +2335,6 @@ describe Project do
...
@@ -2331,10 +2335,6 @@ describe Project do
end
end
describe
'#ensure_storage_path_exist'
do
describe
'#ensure_storage_path_exist'
do
before
do
allow
(
project
).
to
receive
(
:gitlab_shell
).
and_return
(
gitlab_shell
)
end
it
'delegates to gitlab_shell to ensure namespace is created'
do
it
'delegates to gitlab_shell to ensure namespace is created'
do
expect
(
gitlab_shell
).
to
receive
(
:add_namespace
).
with
(
project
.
repository_storage_path
,
project
.
base_dir
)
expect
(
gitlab_shell
).
to
receive
(
:add_namespace
).
with
(
project
.
repository_storage_path
,
project
.
base_dir
)
...
@@ -2392,6 +2392,12 @@ describe Project do
...
@@ -2392,6 +2392,12 @@ describe Project do
it
{
expect
{
subject
}.
to
raise_error
(
StandardError
)
}
it
{
expect
{
subject
}.
to
raise_error
(
StandardError
)
}
end
end
end
end
describe
'#pages_path'
do
it
'returns a path where pages are stored'
do
expect
(
project
.
pages_path
).
to
eq
(
File
.
join
(
Settings
.
pages
.
path
,
project
.
namespace
.
full_path
,
project
.
path
))
end
end
end
end
context
'hashed storage'
do
context
'hashed storage'
do
...
@@ -2402,6 +2408,7 @@ describe Project do
...
@@ -2402,6 +2408,7 @@ describe Project do
before
do
before
do
stub_application_setting
(
hashed_storage_enabled:
true
)
stub_application_setting
(
hashed_storage_enabled:
true
)
allow
(
Digest
::
SHA2
).
to
receive
(
:hexdigest
)
{
hash
}
allow
(
Digest
::
SHA2
).
to
receive
(
:hexdigest
)
{
hash
}
allow
(
project
).
to
receive
(
:gitlab_shell
).
and_return
(
gitlab_shell
)
end
end
describe
'#base_dir'
do
describe
'#base_dir'
do
...
@@ -2411,7 +2418,7 @@ describe Project do
...
@@ -2411,7 +2418,7 @@ describe Project do
end
end
describe
'#disk_path'
do
describe
'#disk_path'
do
it
'returns disk_path based on has of project id'
do
it
'returns disk_path based on has
h
of project id'
do
hashed_path
=
'6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b'
hashed_path
=
'6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b'
expect
(
project
.
disk_path
).
to
eq
(
hashed_path
)
expect
(
project
.
disk_path
).
to
eq
(
hashed_path
)
...
@@ -2419,10 +2426,6 @@ describe Project do
...
@@ -2419,10 +2426,6 @@ describe Project do
end
end
describe
'#ensure_storage_path_exist'
do
describe
'#ensure_storage_path_exist'
do
before
do
allow
(
project
).
to
receive
(
:gitlab_shell
).
and_return
(
gitlab_shell
)
end
it
'delegates to gitlab_shell to ensure namespace is created'
do
it
'delegates to gitlab_shell to ensure namespace is created'
do
expect
(
gitlab_shell
).
to
receive
(
:add_namespace
).
with
(
project
.
repository_storage_path
,
'6b/86'
)
expect
(
gitlab_shell
).
to
receive
(
:add_namespace
).
with
(
project
.
repository_storage_path
,
'6b/86'
)
...
@@ -2472,5 +2475,11 @@ describe Project do
...
@@ -2472,5 +2475,11 @@ describe Project do
it
{
expect
{
subject
}.
to
raise_error
(
StandardError
)
}
it
{
expect
{
subject
}.
to
raise_error
(
StandardError
)
}
end
end
end
end
describe
'#pages_path'
do
it
'returns a path where pages are stored'
do
expect
(
project
.
pages_path
).
to
eq
(
File
.
join
(
Settings
.
pages
.
path
,
project
.
namespace
.
full_path
,
project
.
path
))
end
end
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