BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
4388d903
Commit
4388d903
authored
Nov 07, 2016
by
Grzegorz Bizon
Committed by
Filipa Lacerda
Nov 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add controller specs for environments index action
parent
bd01a5a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
environments_controller_spec.rb
spec/controllers/projects/environments_controller_spec.rb
+27
-6
No files found.
spec/controllers/projects/environments_controller_spec.rb
View file @
4388d903
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
EnvironmentsController
do
describe
Projects
::
EnvironmentsController
do
include
ApiHelpers
let
(
:environment
)
{
create
(
:environment
)
}
let
(
:environment
)
{
create
(
:environment
)
}
let
(
:project
)
{
environment
.
project
}
let
(
:project
)
{
environment
.
project
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
@@ -11,6 +13,27 @@ describe Projects::EnvironmentsController do
...
@@ -11,6 +13,27 @@ describe Projects::EnvironmentsController do
sign_in
(
user
)
sign_in
(
user
)
end
end
describe
'GET index'
do
context
'when standardrequest has been made'
do
it
'responds with status code 200'
do
get
:index
,
environment_params
expect
(
response
).
to
be_ok
end
end
context
'when requesting JSON response'
do
it
'responds with correct JSON'
do
get
:index
,
environment_params
(
format: :json
)
first_environment
=
json_response
.
first
expect
(
first_environment
).
not_to
be_empty
expect
(
first_environment
[
'name'
]).
to
eq
environment
.
name
end
end
end
describe
'GET show'
do
describe
'GET show'
do
context
'with valid id'
do
context
'with valid id'
do
it
'responds with a status code 200'
do
it
'responds with a status code 200'
do
...
@@ -48,11 +71,9 @@ describe Projects::EnvironmentsController do
...
@@ -48,11 +71,9 @@ describe Projects::EnvironmentsController do
end
end
end
end
def
environment_params
def
environment_params
(
opts
=
{})
{
opts
.
reverse_merge
(
namespace_id:
project
.
namespace
,
namespace_id:
project
.
namespace
,
project_id:
project
,
project_id:
project
,
id:
environment
.
id
)
id:
environment
.
id
}
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