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
f095209f
Commit
f095209f
authored
Apr 04, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
7ea6cb33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
spec/graphql/resolvers/environments_resolver_spec.rb
spec/graphql/resolvers/environments_resolver_spec.rb
+55
-0
No files found.
spec/graphql/resolvers/environments_resolver_spec.rb
0 → 100644
View file @
f095209f
# frozen_string_literal: true
require
'spec_helper'
describe
Resolvers
::
EnvironmentsResolver
do
include
GraphqlHelpers
let_it_be
(
:current_user
)
{
create
(
:user
)
}
context
"with a group"
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let!
(
:environment1
)
{
create
(
:environment
,
name:
'production'
,
project:
project
)
}
let!
(
:environment2
)
{
create
(
:environment
,
name:
'test'
,
project:
project
)
}
let!
(
:environment3
)
{
create
(
:environment
,
name:
'test2'
,
project:
project
)
}
before
do
group
.
add_developer
(
current_user
)
end
describe
'#resolve'
do
it
'finds all environments'
do
expect
(
resolve_environments
).
to
contain_exactly
(
environment1
,
environment2
,
environment3
)
end
context
'with name'
do
it
'finds a specific environment with name'
do
expect
(
resolve_environments
(
name:
environment1
.
name
)).
to
contain_exactly
(
environment1
)
end
end
context
'with search'
do
it
'searches environment by name'
do
expect
(
resolve_environments
(
search:
'test'
)).
to
contain_exactly
(
environment2
,
environment3
)
end
context
'when the search term does not match any environments'
do
it
'is empty'
do
expect
(
resolve_environments
(
search:
'nonsense'
)).
to
be_empty
end
end
end
context
'when project is nil'
do
subject
{
resolve
(
described_class
,
obj:
nil
,
args:
{},
ctx:
{
current_user:
current_user
})
}
it
{
is_expected
.
to
be_nil
}
end
end
end
def
resolve_environments
(
args
=
{},
context
=
{
current_user:
current_user
})
resolve
(
described_class
,
obj:
project
,
args:
args
,
ctx:
context
)
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