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
268c698f
Commit
268c698f
authored
Sep 11, 2019
by
Krasimir Angelov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for Pages::VirtualDomain
parent
676675dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
spec/models/pages/virtual_domain_spec.rb
spec/models/pages/virtual_domain_spec.rb
+43
-0
No files found.
spec/models/pages/virtual_domain_spec.rb
0 → 100644
View file @
268c698f
# frozen_string_literal: true
require
'spec_helper'
describe
Pages
::
VirtualDomain
do
describe
'#certificate and #key pair'
do
let
(
:domain
)
{
nil
}
let
(
:project
)
{
instance_double
(
Project
)
}
subject
(
:virtual_domain
)
{
described_class
.
new
([
project
],
domain:
domain
)
}
it
'returns nil if there is no domain provided'
do
expect
(
virtual_domain
.
certificate
).
to
be_nil
expect
(
virtual_domain
.
key
).
to
be_nil
end
context
'when Pages domain is provided'
do
let
(
:domain
)
{
instance_double
(
PagesDomain
,
certificate:
'certificate'
,
key:
'key'
)
}
it
'returns certificate and key from the provided domain'
do
expect
(
virtual_domain
.
certificate
).
to
eq
(
'certificate'
)
expect
(
virtual_domain
.
key
).
to
eq
(
'key'
)
end
end
end
describe
'#lookup_paths'
do
let
(
:domain
)
{
instance_double
(
PagesDomain
)
}
let
(
:project_a
)
{
instance_double
(
Project
)
}
let
(
:project_z
)
{
instance_double
(
Project
)
}
let
(
:pages_lookup_path_a
)
{
instance_double
(
Pages
::
LookupPath
,
prefix:
'aaa'
)
}
let
(
:pages_lookup_path_z
)
{
instance_double
(
Pages
::
LookupPath
,
prefix:
'zzz'
)
}
subject
(
:virtual_domain
)
{
described_class
.
new
([
project_a
,
project_z
],
domain:
domain
)
}
it
'returns collection of projects pages lookup paths sorted by prefix in reverse'
do
expect
(
project_a
).
to
receive
(
:pages_lookup_path
).
with
(
domain:
domain
).
and_return
(
pages_lookup_path_a
)
expect
(
project_z
).
to
receive
(
:pages_lookup_path
).
with
(
domain:
domain
).
and_return
(
pages_lookup_path_z
)
expect
(
virtual_domain
.
lookup_paths
).
to
eq
([
pages_lookup_path_z
,
pages_lookup_path_a
])
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