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
cd67df08
Commit
cd67df08
authored
Jul 24, 2020
by
Jacob Vosmaer
Committed by
Mayra Cabrera
Jul 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use pages_metadatum in Project#pages_deployed?
parent
f425177f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
9 deletions
+7
-9
app/models/project.rb
app/models/project.rb
+1
-5
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-2
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+4
-2
No files found.
app/models/project.rb
View file @
cd67df08
...
...
@@ -1740,7 +1740,7 @@ class Project < ApplicationRecord
end
def
pages_deployed?
Dir
.
exist?
(
public_pages_path
)
pages_metadatum
&
.
deployed?
end
def
pages_group_url
...
...
@@ -1773,10 +1773,6 @@ class Project < ApplicationRecord
File
.
join
(
Settings
.
pages
.
path
,
full_path
)
end
def
public_pages_path
File
.
join
(
pages_path
,
'public'
)
end
def
pages_available?
Gitlab
.
config
.
pages
.
enabled
end
...
...
spec/models/project_spec.rb
View file @
cd67df08
...
...
@@ -1698,9 +1698,9 @@ RSpec.describe Project do
subject
{
project
.
pages_deployed?
}
context
'if p
ublic folder does exist
'
do
context
'if p
ages are deployed
'
do
before
do
allow
(
Dir
).
to
receive
(
:exist?
).
with
(
project
.
public_pages_path
).
and_return
(
true
)
project
.
pages_metadatum
.
update_column
(
:deployed
,
true
)
end
it
{
is_expected
.
to
be_truthy
}
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
cd67df08
...
...
@@ -53,7 +53,7 @@ RSpec.describe Projects::UpdatePagesService do
# Check that all expected files are extracted
%w[index.html zero .hidden/file]
.
each
do
|
filename
|
expect
(
File
.
exist?
(
File
.
join
(
project
.
p
ublic_pages_path
,
filename
))).
to
be_truthy
expect
(
File
.
exist?
(
File
.
join
(
project
.
p
ages_path
,
'public'
,
filename
))).
to
be_truthy
end
end
...
...
@@ -65,15 +65,17 @@ RSpec.describe Projects::UpdatePagesService do
it
'removes pages after destroy'
do
expect
(
PagesWorker
).
to
receive
(
:perform_in
)
expect
(
project
.
pages_deployed?
).
to
be_falsey
expect
(
Dir
.
exist?
(
File
.
join
(
project
.
pages_path
))).
to
be_falsey
expect
(
execute
).
to
eq
(
:success
)
expect
(
project
.
pages_metadatum
).
to
be_deployed
expect
(
project
.
pages_deployed?
).
to
be_truthy
expect
(
Dir
.
exist?
(
File
.
join
(
project
.
pages_path
))).
to
be_truthy
project
.
destroy
expect
(
project
.
pages_deployed?
).
to
be_falsey
expect
(
Dir
.
exist?
(
File
.
join
(
project
.
pages_path
))
).
to
be_falsey
expect
(
ProjectPagesMetadatum
.
find_by_project_id
(
project
)).
to
be_nil
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