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
a0719cb4
Commit
a0719cb4
authored
May 06, 2020
by
Vasilii Iakliushin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `let_it_be` for Static Site Editor tests
parent
1d1c40f9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
12 deletions
+10
-12
spec/controllers/projects/static_site_editor_controller_spec.rb
...ontrollers/projects/static_site_editor_controller_spec.rb
+6
-9
spec/features/static_site_editor_spec.rb
spec/features/static_site_editor_spec.rb
+2
-2
spec/requests/api/graphql/mutations/branches/create_spec.rb
spec/requests/api/graphql/mutations/branches/create_spec.rb
+2
-1
No files found.
spec/controllers/projects/static_site_editor_controller_spec.rb
View file @
a0719cb4
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
StaticSiteEditorController
do
describe
Projects
::
StaticSiteEditorController
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
describe
'GET show'
do
describe
'GET show'
do
let
(
:default_params
)
do
let
(
:default_params
)
do
...
@@ -27,8 +28,6 @@ describe Projects::StaticSiteEditorController do
...
@@ -27,8 +28,6 @@ describe Projects::StaticSiteEditorController do
end
end
context
'as guest'
do
context
'as guest'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
project
.
add_guest
(
user
)
project
.
add_guest
(
user
)
sign_in
(
user
)
sign_in
(
user
)
...
@@ -42,10 +41,11 @@ describe Projects::StaticSiteEditorController do
...
@@ -42,10 +41,11 @@ describe Projects::StaticSiteEditorController do
%w[developer maintainer]
.
each
do
|
role
|
%w[developer maintainer]
.
each
do
|
role
|
context
"as
#{
role
}
"
do
context
"as
#{
role
}
"
do
let
(
:user
)
{
create
(
:user
)
}
before_all
do
project
.
add_role
(
user
,
role
)
end
before
do
before
do
project
.
add_role
(
user
,
role
)
sign_in
(
user
)
sign_in
(
user
)
get
:show
,
params:
default_params
get
:show
,
params:
default_params
end
end
...
@@ -54,11 +54,8 @@ describe Projects::StaticSiteEditorController do
...
@@ -54,11 +54,8 @@ describe Projects::StaticSiteEditorController do
expect
(
response
).
to
render_template
(
:show
)
expect
(
response
).
to
render_template
(
:show
)
end
end
it
'assigns a
config variable
'
do
it
'assigns a
required variables
'
do
expect
(
assigns
(
:config
)).
to
be_a
(
Gitlab
::
StaticSiteEditor
::
Config
)
expect
(
assigns
(
:config
)).
to
be_a
(
Gitlab
::
StaticSiteEditor
::
Config
)
end
it
'correctly assigns ref and path'
do
expect
(
assigns
(
:ref
)).
to
eq
(
'master'
)
expect
(
assigns
(
:ref
)).
to
eq
(
'master'
)
expect
(
assigns
(
:path
)).
to
eq
(
'README.md'
)
expect
(
assigns
(
:path
)).
to
eq
(
'README.md'
)
end
end
...
...
spec/features/static_site_editor_spec.rb
View file @
a0719cb4
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
require
'spec_helper'
require
'spec_helper'
describe
'Static Site Editor'
do
describe
'Static Site Editor'
do
let
(
:user
)
{
create
(
:user
)
}
let
_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
before
do
before
do
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
...
...
spec/requests/api/graphql/mutations/branches/create_spec.rb
View file @
a0719cb4
...
@@ -6,7 +6,7 @@ describe 'Creation of a new branch' do
...
@@ -6,7 +6,7 @@ describe 'Creation of a new branch' do
include
GraphqlHelpers
include
GraphqlHelpers
let_it_be
(
:current_user
)
{
create
(
:user
)
}
let_it_be
(
:current_user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:public
,
:empty_repo
)
}
let
(
:input
)
{
{
project_path:
project
.
full_path
,
name:
new_branch
,
ref:
ref
}
}
let
(
:input
)
{
{
project_path:
project
.
full_path
,
name:
new_branch
,
ref:
ref
}
}
let
(
:new_branch
)
{
'new_branch'
}
let
(
:new_branch
)
{
'new_branch'
}
let
(
:ref
)
{
'master'
}
let
(
:ref
)
{
'master'
}
...
@@ -35,6 +35,7 @@ describe 'Creation of a new branch' do
...
@@ -35,6 +35,7 @@ describe 'Creation of a new branch' do
end
end
context
'when ref is not correct'
do
context
'when ref is not correct'
do
let
(
:new_branch
)
{
'another_branch'
}
let
(
:ref
)
{
'unknown'
}
let
(
:ref
)
{
'unknown'
}
it_behaves_like
'a mutation that returns errors in the response'
,
it_behaves_like
'a mutation that returns errors in the response'
,
...
...
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