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
Boxiang Sun
gitlab-ce
Commits
bf735200
Commit
bf735200
authored
Dec 19, 2018
by
Jasper Maes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert specs in javascripts/ and support/ to new syntax
parent
f1464680
Changes
37
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
165 additions
and
158 deletions
+165
-158
changelogs/unreleased/specs-positional-arguments.yml
changelogs/unreleased/specs-positional-arguments.yml
+5
-0
spec/controllers/projects/tags/releases_controller_spec.rb
spec/controllers/projects/tags/releases_controller_spec.rb
+4
-3
spec/javascripts/fixtures/blob.rb
spec/javascripts/fixtures/blob.rb
+5
-4
spec/javascripts/fixtures/boards.rb
spec/javascripts/fixtures/boards.rb
+4
-3
spec/javascripts/fixtures/branches.rb
spec/javascripts/fixtures/branches.rb
+2
-1
spec/javascripts/fixtures/clusters.rb
spec/javascripts/fixtures/clusters.rb
+2
-1
spec/javascripts/fixtures/commit.rb
spec/javascripts/fixtures/commit.rb
+1
-1
spec/javascripts/fixtures/deploy_keys.rb
spec/javascripts/fixtures/deploy_keys.rb
+3
-3
spec/javascripts/fixtures/groups.rb
spec/javascripts/fixtures/groups.rb
+2
-4
spec/javascripts/fixtures/issues.rb
spec/javascripts/fixtures/issues.rb
+4
-2
spec/javascripts/fixtures/jobs.rb
spec/javascripts/fixtures/jobs.rb
+7
-6
spec/javascripts/fixtures/labels.rb
spec/javascripts/fixtures/labels.rb
+6
-6
spec/javascripts/fixtures/merge_requests.rb
spec/javascripts/fixtures/merge_requests.rb
+6
-6
spec/javascripts/fixtures/merge_requests_diffs.rb
spec/javascripts/fixtures/merge_requests_diffs.rb
+2
-2
spec/javascripts/fixtures/pipeline_schedules.rb
spec/javascripts/fixtures/pipeline_schedules.rb
+4
-2
spec/javascripts/fixtures/pipelines.rb
spec/javascripts/fixtures/pipelines.rb
+3
-3
spec/javascripts/fixtures/projects.rb
spec/javascripts/fixtures/projects.rb
+10
-5
spec/javascripts/fixtures/prometheus_service.rb
spec/javascripts/fixtures/prometheus_service.rb
+2
-1
spec/javascripts/fixtures/services.rb
spec/javascripts/fixtures/services.rb
+2
-1
spec/javascripts/fixtures/snippet.rb
spec/javascripts/fixtures/snippet.rb
+1
-1
spec/javascripts/fixtures/todos.rb
spec/javascripts/fixtures/todos.rb
+3
-3
spec/javascripts/fixtures/u2f.rb
spec/javascripts/fixtures/u2f.rb
+1
-1
spec/requests/api/events_spec.rb
spec/requests/api/events_spec.rb
+2
-2
spec/requests/api/files_spec.rb
spec/requests/api/files_spec.rb
+6
-6
spec/support/api/boards_shared_examples.rb
spec/support/api/boards_shared_examples.rb
+6
-9
spec/support/api/milestones_shared_examples.rb
spec/support/api/milestones_shared_examples.rb
+13
-18
spec/support/api/scopes/read_user_shared_examples.rb
spec/support/api/scopes/read_user_shared_examples.rb
+1
-1
spec/support/api/time_tracking_shared_examples.rb
spec/support/api/time_tracking_shared_examples.rb
+9
-13
spec/support/controllers/githubish_import_controller_shared_examples.rb
...ontrollers/githubish_import_controller_shared_examples.rb
+17
-17
spec/support/helpers/git_http_helpers.rb
spec/support/helpers/git_http_helpers.rb
+4
-4
spec/support/helpers/graphql_helpers.rb
spec/support/helpers/graphql_helpers.rb
+1
-1
spec/support/issuables_requiring_filter_shared_examples.rb
spec/support/issuables_requiring_filter_shared_examples.rb
+1
-1
spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb
...d_examples/controllers/uploads_actions_shared_examples.rb
+5
-6
spec/support/shared_examples/milestone_tabs_examples.rb
spec/support/shared_examples/milestone_tabs_examples.rb
+1
-1
spec/support/shared_examples/requests/api/merge_requests_list.rb
...pport/shared_examples/requests/api/merge_requests_list.rb
+8
-8
spec/support/shared_examples/requests/api/notes.rb
spec/support/shared_examples/requests/api/notes.rb
+5
-5
spec/support/shared_examples/requests/api/resolvable_discussions.rb
...rt/shared_examples/requests/api/resolvable_discussions.rb
+7
-7
No files found.
changelogs/unreleased/specs-positional-arguments.yml
0 → 100644
View file @
bf735200
---
title
:
convert specs in javascripts/ and support/ to new syntax
merge_request
:
23947
author
:
Jasper Maes
type
:
other
spec/controllers/projects/tags/releases_controller_spec.rb
View file @
bf735200
...
@@ -18,7 +18,7 @@ describe Projects::Tags::ReleasesController do
...
@@ -18,7 +18,7 @@ describe Projects::Tags::ReleasesController do
tag_id
=
release
.
tag
tag_id
=
release
.
tag
project
.
releases
.
destroy_all
# rubocop: disable DestroyAll
project
.
releases
.
destroy_all
# rubocop: disable DestroyAll
get
:edit
,
namespace_id:
project
.
namespace
,
project_id:
project
,
tag_id:
tag_id
get
:edit
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
,
tag_id:
tag_id
}
release
=
assigns
(
:release
)
release
=
assigns
(
:release
)
expect
(
release
).
not_to
be_nil
expect
(
release
).
not_to
be_nil
...
@@ -26,7 +26,7 @@ describe Projects::Tags::ReleasesController do
...
@@ -26,7 +26,7 @@ describe Projects::Tags::ReleasesController do
end
end
it
'retrieves an existing release'
do
it
'retrieves an existing release'
do
get
:edit
,
namespace_id:
project
.
namespace
,
project_id:
project
,
tag_id:
release
.
tag
get
:edit
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
,
tag_id:
release
.
tag
}
release
=
assigns
(
:release
)
release
=
assigns
(
:release
)
expect
(
release
).
not_to
be_nil
expect
(
release
).
not_to
be_nil
...
@@ -48,10 +48,11 @@ describe Projects::Tags::ReleasesController do
...
@@ -48,10 +48,11 @@ describe Projects::Tags::ReleasesController do
end
end
def
update_release
(
description
)
def
update_release
(
description
)
put
:update
,
put
:update
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
tag_id:
release
.
tag
,
tag_id:
release
.
tag
,
release:
{
description:
description
}
release:
{
description:
description
}
}
end
end
end
end
spec/javascripts/fixtures/blob.rb
View file @
bf735200
...
@@ -22,10 +22,11 @@ describe Projects::BlobController, '(JavaScript fixtures)', type: :controller do
...
@@ -22,10 +22,11 @@ describe Projects::BlobController, '(JavaScript fixtures)', type: :controller do
end
end
it
'blob/show.html.raw'
do
|
example
|
it
'blob/show.html.raw'
do
|
example
|
get
(
:show
,
get
(
:show
,
params:
{
namespace_id:
project
.
namespace
,
namespace_id:
project
.
namespace
,
project_id:
project
,
project_id:
project
,
id:
'add-ipython-files/files/ipython/basic.ipynb'
)
id:
'add-ipython-files/files/ipython/basic.ipynb'
})
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/boards.rb
View file @
bf735200
...
@@ -18,9 +18,10 @@ describe Projects::BoardsController, '(JavaScript fixtures)', type: :controller
...
@@ -18,9 +18,10 @@ describe Projects::BoardsController, '(JavaScript fixtures)', type: :controller
end
end
it
'boards/show.html.raw'
do
|
example
|
it
'boards/show.html.raw'
do
|
example
|
get
(
:index
,
get
(
:index
,
params:
{
namespace_id:
project
.
namespace
,
namespace_id:
project
.
namespace
,
project_id:
project
)
project_id:
project
})
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/branches.rb
View file @
bf735200
...
@@ -22,9 +22,10 @@ describe Projects::BranchesController, '(JavaScript fixtures)', type: :controlle
...
@@ -22,9 +22,10 @@ describe Projects::BranchesController, '(JavaScript fixtures)', type: :controlle
end
end
it
'branches/new_branch.html.raw'
do
|
example
|
it
'branches/new_branch.html.raw'
do
|
example
|
get
:new
,
get
:new
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
project_id:
project
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/clusters.rb
View file @
bf735200
...
@@ -23,10 +23,11 @@ describe Projects::ClustersController, '(JavaScript fixtures)', type: :controlle
...
@@ -23,10 +23,11 @@ describe Projects::ClustersController, '(JavaScript fixtures)', type: :controlle
end
end
it
'clusters/show_cluster.html.raw'
do
|
example
|
it
'clusters/show_cluster.html.raw'
do
|
example
|
get
:show
,
get
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
id:
cluster
id:
cluster
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/commit.rb
View file @
bf735200
...
@@ -25,7 +25,7 @@ describe Projects::CommitController, '(JavaScript fixtures)', type: :controller
...
@@ -25,7 +25,7 @@ describe Projects::CommitController, '(JavaScript fixtures)', type: :controller
id:
commit
.
id
id:
commit
.
id
}
}
get
:show
,
params
get
:show
,
params
:
params
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/deploy_keys.rb
View file @
bf735200
...
@@ -33,10 +33,10 @@ describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :control
...
@@ -33,10 +33,10 @@ describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :control
create
(
:deploy_keys_project
,
project:
project3
,
deploy_key:
project_key
)
create
(
:deploy_keys_project
,
project:
project3
,
deploy_key:
project_key
)
create
(
:deploy_keys_project
,
project:
project4
,
deploy_key:
project_key
)
create
(
:deploy_keys_project
,
project:
project4
,
deploy_key:
project_key
)
get
:index
,
get
:index
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
format: :json
},
format: :json
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/groups.rb
View file @
bf735200
...
@@ -19,8 +19,7 @@ describe 'Groups (JavaScript fixtures)', type: :controller do
...
@@ -19,8 +19,7 @@ describe 'Groups (JavaScript fixtures)', type: :controller do
describe
GroupsController
,
'(JavaScript fixtures)'
,
type: :controller
do
describe
GroupsController
,
'(JavaScript fixtures)'
,
type: :controller
do
it
'groups/edit.html.raw'
do
|
example
|
it
'groups/edit.html.raw'
do
|
example
|
get
:edit
,
get
:edit
,
params:
{
id:
group
}
id:
group
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
@@ -29,8 +28,7 @@ describe 'Groups (JavaScript fixtures)', type: :controller do
...
@@ -29,8 +28,7 @@ describe 'Groups (JavaScript fixtures)', type: :controller do
describe
Groups
::
Settings
::
CiCdController
,
'(JavaScript fixtures)'
,
type: :controller
do
describe
Groups
::
Settings
::
CiCdController
,
'(JavaScript fixtures)'
,
type: :controller
do
it
'groups/ci_cd_settings.html.raw'
do
|
example
|
it
'groups/ci_cd_settings.html.raw'
do
|
example
|
get
:show
,
get
:show
,
params:
{
group_id:
group
}
group_id:
group
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/issues.rb
View file @
bf735200
...
@@ -43,9 +43,10 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller
...
@@ -43,9 +43,10 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller
it
'issues/issue_list.html.raw'
do
|
example
|
it
'issues/issue_list.html.raw'
do
|
example
|
create
(
:issue
,
project:
project
)
create
(
:issue
,
project:
project
)
get
:index
,
get
:index
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
project_id:
project
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
@@ -54,10 +55,11 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller
...
@@ -54,10 +55,11 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller
private
private
def
render_issue
(
fixture_file_name
,
issue
)
def
render_issue
(
fixture_file_name
,
issue
)
get
:show
,
get
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
id:
issue
.
to_param
id:
issue
.
to_param
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
fixture_file_name
)
store_frontend_fixture
(
response
,
fixture_file_name
)
...
...
spec/javascripts/fixtures/jobs.rb
View file @
bf735200
...
@@ -34,21 +34,22 @@ describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do
...
@@ -34,21 +34,22 @@ describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do
end
end
it
'builds/build-with-artifacts.html.raw'
do
|
example
|
it
'builds/build-with-artifacts.html.raw'
do
|
example
|
get
:show
,
get
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
id:
build_with_artifacts
.
to_param
id:
build_with_artifacts
.
to_param
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
end
end
it
'jobs/delayed.json'
do
|
example
|
it
'jobs/delayed.json'
do
|
example
|
get
:show
,
get
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
id:
delayed_job
.
to_param
,
id:
delayed_job
.
to_param
format: :json
},
format: :json
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/labels.rb
View file @
bf735200
...
@@ -31,9 +31,9 @@ describe 'Labels (JavaScript fixtures)' do
...
@@ -31,9 +31,9 @@ describe 'Labels (JavaScript fixtures)' do
end
end
it
'labels/group_labels.json'
do
|
example
|
it
'labels/group_labels.json'
do
|
example
|
get
:index
,
get
:index
,
params:
{
group_id:
group
,
group_id:
group
format:
'json'
},
format:
'json'
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
@@ -48,10 +48,10 @@ describe 'Labels (JavaScript fixtures)' do
...
@@ -48,10 +48,10 @@ describe 'Labels (JavaScript fixtures)' do
end
end
it
'labels/project_labels.json'
do
|
example
|
it
'labels/project_labels.json'
do
|
example
|
get
:index
,
get
:index
,
params:
{
namespace_id:
group
,
namespace_id:
group
,
project_id:
project
,
project_id:
project
format:
'json'
},
format:
'json'
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/merge_requests.rb
View file @
bf735200
...
@@ -112,21 +112,21 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
...
@@ -112,21 +112,21 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
private
private
def
render_discussions_json
(
merge_request
,
fixture_file_name
)
def
render_discussions_json
(
merge_request
,
fixture_file_name
)
get
:discussions
,
get
:discussions
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
id:
merge_request
.
to_param
,
id:
merge_request
.
to_param
format: :json
},
format: :json
store_frontend_fixture
(
response
,
fixture_file_name
)
store_frontend_fixture
(
response
,
fixture_file_name
)
end
end
def
render_merge_request
(
fixture_file_name
,
merge_request
)
def
render_merge_request
(
fixture_file_name
,
merge_request
)
get
:show
,
get
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
id:
merge_request
.
to_param
,
id:
merge_request
.
to_param
format: :html
},
format: :html
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
fixture_file_name
)
store_frontend_fixture
(
response
,
fixture_file_name
)
...
...
spec/javascripts/fixtures/merge_requests_diffs.rb
View file @
bf735200
...
@@ -57,13 +57,13 @@ describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type
...
@@ -57,13 +57,13 @@ describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type
private
private
def
render_merge_request
(
fixture_file_name
,
merge_request
,
view:
'inline'
,
**
extra_params
)
def
render_merge_request
(
fixture_file_name
,
merge_request
,
view:
'inline'
,
**
extra_params
)
get
:show
,
get
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
id:
merge_request
.
to_param
,
id:
merge_request
.
to_param
,
format: :json
,
view:
view
,
view:
view
,
**
extra_params
**
extra_params
},
format: :json
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
fixture_file_name
)
store_frontend_fixture
(
response
,
fixture_file_name
)
...
...
spec/javascripts/fixtures/pipeline_schedules.rb
View file @
bf735200
...
@@ -22,20 +22,22 @@ describe Projects::PipelineSchedulesController, '(JavaScript fixtures)', type: :
...
@@ -22,20 +22,22 @@ describe Projects::PipelineSchedulesController, '(JavaScript fixtures)', type: :
end
end
it
'pipeline_schedules/edit.html.raw'
do
|
example
|
it
'pipeline_schedules/edit.html.raw'
do
|
example
|
get
:edit
,
get
:edit
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
id:
pipeline_schedule
.
id
id:
pipeline_schedule
.
id
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
end
end
it
'pipeline_schedules/edit_with_variables.html.raw'
do
|
example
|
it
'pipeline_schedules/edit_with_variables.html.raw'
do
|
example
|
get
:edit
,
get
:edit
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
id:
pipeline_schedule_populated
.
id
id:
pipeline_schedule_populated
.
id
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/pipelines.rb
View file @
bf735200
...
@@ -24,10 +24,10 @@ describe Projects::PipelinesController, '(JavaScript fixtures)', type: :controll
...
@@ -24,10 +24,10 @@ describe Projects::PipelinesController, '(JavaScript fixtures)', type: :controll
end
end
it
'pipelines/pipelines.json'
do
|
example
|
it
'pipelines/pipelines.json'
do
|
example
|
get
:index
,
get
:index
,
params:
{
namespace_id:
namespace
,
namespace_id:
namespace
,
project_id:
project
,
project_id:
project
format: :json
},
format: :json
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/projects.rb
View file @
bf735200
...
@@ -28,27 +28,30 @@ describe 'Projects (JavaScript fixtures)', type: :controller do
...
@@ -28,27 +28,30 @@ describe 'Projects (JavaScript fixtures)', type: :controller do
describe
ProjectsController
,
'(JavaScript fixtures)'
,
type: :controller
do
describe
ProjectsController
,
'(JavaScript fixtures)'
,
type: :controller
do
it
'projects/dashboard.html.raw'
do
|
example
|
it
'projects/dashboard.html.raw'
do
|
example
|
get
:show
,
get
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
id:
project
id:
project
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
end
end
it
'projects/overview.html.raw'
do
|
example
|
it
'projects/overview.html.raw'
do
|
example
|
get
:show
,
get
:show
,
params:
{
namespace_id:
project_with_repo
.
namespace
.
to_param
,
namespace_id:
project_with_repo
.
namespace
.
to_param
,
id:
project_with_repo
id:
project_with_repo
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
end
end
it
'projects/edit.html.raw'
do
|
example
|
it
'projects/edit.html.raw'
do
|
example
|
get
:edit
,
get
:edit
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
id:
project
id:
project
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
@@ -57,18 +60,20 @@ describe 'Projects (JavaScript fixtures)', type: :controller do
...
@@ -57,18 +60,20 @@ describe 'Projects (JavaScript fixtures)', type: :controller do
describe
Projects
::
Settings
::
CiCdController
,
'(JavaScript fixtures)'
,
type: :controller
do
describe
Projects
::
Settings
::
CiCdController
,
'(JavaScript fixtures)'
,
type: :controller
do
it
'projects/ci_cd_settings.html.raw'
do
|
example
|
it
'projects/ci_cd_settings.html.raw'
do
|
example
|
get
:show
,
get
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
project_id:
project
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
end
end
it
'projects/ci_cd_settings_with_variables.html.raw'
do
|
example
|
it
'projects/ci_cd_settings_with_variables.html.raw'
do
|
example
|
get
:show
,
get
:show
,
params:
{
namespace_id:
project_variable_populated
.
namespace
.
to_param
,
namespace_id:
project_variable_populated
.
namespace
.
to_param
,
project_id:
project_variable_populated
project_id:
project_variable_populated
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/prometheus_service.rb
View file @
bf735200
...
@@ -23,10 +23,11 @@ describe Projects::ServicesController, '(JavaScript fixtures)', type: :controlle
...
@@ -23,10 +23,11 @@ describe Projects::ServicesController, '(JavaScript fixtures)', type: :controlle
end
end
it
'services/prometheus/prometheus_service.html.raw'
do
|
example
|
it
'services/prometheus/prometheus_service.html.raw'
do
|
example
|
get
:edit
,
get
:edit
,
params:
{
namespace_id:
namespace
,
namespace_id:
namespace
,
project_id:
project
,
project_id:
project
,
id:
service
.
to_param
id:
service
.
to_param
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/services.rb
View file @
bf735200
...
@@ -23,10 +23,11 @@ describe Projects::ServicesController, '(JavaScript fixtures)', type: :controlle
...
@@ -23,10 +23,11 @@ describe Projects::ServicesController, '(JavaScript fixtures)', type: :controlle
end
end
it
'services/edit_service.html.raw'
do
|
example
|
it
'services/edit_service.html.raw'
do
|
example
|
get
:edit
,
get
:edit
,
params:
{
namespace_id:
namespace
,
namespace_id:
namespace
,
project_id:
project
,
project_id:
project
,
id:
service
.
to_param
id:
service
.
to_param
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/snippet.rb
View file @
bf735200
...
@@ -24,7 +24,7 @@ describe SnippetsController, '(JavaScript fixtures)', type: :controller do
...
@@ -24,7 +24,7 @@ describe SnippetsController, '(JavaScript fixtures)', type: :controller do
end
end
it
'snippets/show.html.raw'
do
|
example
|
it
'snippets/show.html.raw'
do
|
example
|
get
(
:show
,
id:
snippet
.
to_param
)
get
(
:show
,
params:
{
id:
snippet
.
to_param
}
)
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/todos.rb
View file @
bf735200
...
@@ -42,12 +42,12 @@ describe 'Todos (JavaScript fixtures)' do
...
@@ -42,12 +42,12 @@ describe 'Todos (JavaScript fixtures)' do
end
end
it
'todos/todos.json'
do
|
example
|
it
'todos/todos.json'
do
|
example
|
post
:create
,
post
:create
,
params:
{
namespace_id:
namespace
,
namespace_id:
namespace
,
project_id:
project
,
project_id:
project
,
issuable_type:
'issue'
,
issuable_type:
'issue'
,
issuable_id:
issue_2
.
id
,
issuable_id:
issue_2
.
id
format:
'json'
},
format:
'json'
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/javascripts/fixtures/u2f.rb
View file @
bf735200
...
@@ -21,7 +21,7 @@ context 'U2F' do
...
@@ -21,7 +21,7 @@ context 'U2F' do
it
'u2f/authenticate.html.raw'
do
|
example
|
it
'u2f/authenticate.html.raw'
do
|
example
|
allow
(
controller
).
to
receive
(
:find_user
).
and_return
(
user
)
allow
(
controller
).
to
receive
(
:find_user
).
and_return
(
user
)
post
:create
,
user:
{
login:
user
.
username
,
password:
user
.
password
}
post
:create
,
params:
{
user:
{
login:
user
.
username
,
password:
user
.
password
}
}
expect
(
response
).
to
be_success
expect
(
response
).
to
be_success
store_frontend_fixture
(
response
,
example
.
description
)
store_frontend_fixture
(
response
,
example
.
description
)
...
...
spec/requests/api/events_spec.rb
View file @
bf735200
...
@@ -226,7 +226,7 @@ describe API::Events do
...
@@ -226,7 +226,7 @@ describe API::Events do
end
end
it
'correctly returns the second page without inaccessible events'
do
it
'correctly returns the second page without inaccessible events'
do
get
api
(
"/projects/
#{
public_project
.
id
}
/events"
,
user
),
p
er_page:
2
,
page:
2
get
api
(
"/projects/
#{
public_project
.
id
}
/events"
,
user
),
p
arams:
{
per_page:
2
,
page:
2
}
titles
=
json_response
.
map
{
|
event
|
event
[
'target_title'
]
}
titles
=
json_response
.
map
{
|
event
|
event
[
'target_title'
]
}
...
@@ -235,7 +235,7 @@ describe API::Events do
...
@@ -235,7 +235,7 @@ describe API::Events do
end
end
it
'correctly returns the first page without inaccessible events'
do
it
'correctly returns the first page without inaccessible events'
do
get
api
(
"/projects/
#{
public_project
.
id
}
/events"
,
user
),
p
er_page:
2
,
page:
1
get
api
(
"/projects/
#{
public_project
.
id
}
/events"
,
user
),
p
arams:
{
per_page:
2
,
page:
1
}
titles
=
json_response
.
map
{
|
event
|
event
[
'target_title'
]
}
titles
=
json_response
.
map
{
|
event
|
event
[
'target_title'
]
}
...
...
spec/requests/api/files_spec.rb
View file @
bf735200
...
@@ -54,7 +54,7 @@ describe API::Files do
...
@@ -54,7 +54,7 @@ describe API::Files do
describe
"HEAD /projects/:id/repository/files/:file_path"
do
describe
"HEAD /projects/:id/repository/files/:file_path"
do
shared_examples_for
'repository files'
do
shared_examples_for
'repository files'
do
it
'returns file attributes in headers'
do
it
'returns file attributes in headers'
do
head
api
(
route
(
file_path
),
current_user
),
params
head
api
(
route
(
file_path
),
current_user
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
.
headers
[
'X-Gitlab-File-Path'
]).
to
eq
(
CGI
.
unescape
(
file_path
))
expect
(
response
.
headers
[
'X-Gitlab-File-Path'
]).
to
eq
(
CGI
.
unescape
(
file_path
))
...
@@ -68,7 +68,7 @@ describe API::Files do
...
@@ -68,7 +68,7 @@ describe API::Files do
file_path
=
"files%2Fjs%2Fcommit%2Ejs%2Ecoffee"
file_path
=
"files%2Fjs%2Fcommit%2Ejs%2Ecoffee"
params
[
:ref
]
=
"6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9"
params
[
:ref
]
=
"6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9"
head
api
(
route
(
file_path
),
current_user
),
params
head
api
(
route
(
file_path
),
current_user
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
.
headers
[
'X-Gitlab-File-Name'
]).
to
eq
(
'commit.js.coffee'
)
expect
(
response
.
headers
[
'X-Gitlab-File-Name'
]).
to
eq
(
'commit.js.coffee'
)
...
@@ -87,7 +87,7 @@ describe API::Files do
...
@@ -87,7 +87,7 @@ describe API::Files do
it
"responds with a 404 status"
do
it
"responds with a 404 status"
do
params
[
:ref
]
=
'master'
params
[
:ref
]
=
'master'
head
api
(
route
(
'app%2Fmodels%2Fapplication%2Erb'
),
current_user
),
params
head
api
(
route
(
'app%2Fmodels%2Fapplication%2Erb'
),
current_user
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
...
@@ -97,7 +97,7 @@ describe API::Files do
...
@@ -97,7 +97,7 @@ describe API::Files do
include_context
'disabled repository'
include_context
'disabled repository'
it
"responds with a 403 status"
do
it
"responds with a 403 status"
do
head
api
(
route
(
file_path
),
current_user
),
params
head
api
(
route
(
file_path
),
current_user
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
...
@@ -115,7 +115,7 @@ describe API::Files do
...
@@ -115,7 +115,7 @@ describe API::Files do
it
"responds with a 404 status"
do
it
"responds with a 404 status"
do
current_user
=
nil
current_user
=
nil
head
api
(
route
(
file_path
),
current_user
),
params
head
api
(
route
(
file_path
),
current_user
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
...
@@ -136,7 +136,7 @@ describe API::Files do
...
@@ -136,7 +136,7 @@ describe API::Files do
context
'when authenticated'
,
'as a guest'
do
context
'when authenticated'
,
'as a guest'
do
it_behaves_like
'403 response'
do
it_behaves_like
'403 response'
do
let
(
:request
)
{
head
api
(
route
(
file_path
),
guest
),
params
}
let
(
:request
)
{
head
api
(
route
(
file_path
),
guest
),
params
:
params
}
end
end
end
end
end
end
...
...
spec/support/api/boards_shared_examples.rb
View file @
bf735200
...
@@ -88,7 +88,7 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false|
...
@@ -88,7 +88,7 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false|
let
(
:url
)
{
"
#{
root_url
}
/
#{
board
.
id
}
/lists"
}
let
(
:url
)
{
"
#{
root_url
}
/
#{
board
.
id
}
/lists"
}
it
'creates a new issue board list for labels'
do
it
'creates a new issue board list for labels'
do
post
api
(
url
,
user
),
label_id:
ux_label
.
id
post
api
(
url
,
user
),
params:
{
label_id:
ux_label
.
id
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'label'
][
'name'
]).
to
eq
(
ux_label
.
title
)
expect
(
json_response
[
'label'
][
'name'
]).
to
eq
(
ux_label
.
title
)
...
@@ -96,13 +96,13 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false|
...
@@ -96,13 +96,13 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false|
end
end
it
'returns 400 when creating a new list if label_id is invalid'
do
it
'returns 400 when creating a new list if label_id is invalid'
do
post
api
(
url
,
user
),
label_id:
23423
post
api
(
url
,
user
),
params:
{
label_id:
23423
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
400
)
end
end
it
'returns 403 for members with guest role'
do
it
'returns 403 for members with guest role'
do
put
api
(
"
#{
url
}
/
#{
test_list
.
id
}
"
,
guest
),
p
osition:
1
put
api
(
"
#{
url
}
/
#{
test_list
.
id
}
"
,
guest
),
p
arams:
{
position:
1
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
...
@@ -112,23 +112,20 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false|
...
@@ -112,23 +112,20 @@ shared_examples_for 'group and project boards' do |route_definition, ee = false|
let
(
:url
)
{
"
#{
root_url
}
/
#{
board
.
id
}
/lists"
}
let
(
:url
)
{
"
#{
root_url
}
/
#{
board
.
id
}
/lists"
}
it
"updates a list"
do
it
"updates a list"
do
put
api
(
"
#{
url
}
/
#{
test_list
.
id
}
"
,
user
),
put
api
(
"
#{
url
}
/
#{
test_list
.
id
}
"
,
user
),
params:
{
position:
1
}
position:
1
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'position'
]).
to
eq
(
1
)
expect
(
json_response
[
'position'
]).
to
eq
(
1
)
end
end
it
"returns 404 error if list id not found"
do
it
"returns 404 error if list id not found"
do
put
api
(
"
#{
url
}
/44444"
,
user
),
put
api
(
"
#{
url
}
/44444"
,
user
),
params:
{
position:
1
}
position:
1
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
it
"returns 403 for members with guest role"
do
it
"returns 403 for members with guest role"
do
put
api
(
"
#{
url
}
/
#{
test_list
.
id
}
"
,
guest
),
put
api
(
"
#{
url
}
/
#{
test_list
.
id
}
"
,
guest
),
params:
{
position:
1
}
position:
1
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
...
...
spec/support/api/milestones_shared_examples.rb
View file @
bf735200
...
@@ -45,7 +45,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
...
@@ -45,7 +45,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
it
'returns an array of milestones specified by iids'
do
it
'returns an array of milestones specified by iids'
do
other_milestone
=
create
(
:milestone
,
project:
try
(
:project
),
group:
try
(
:group
))
other_milestone
=
create
(
:milestone
,
project:
try
(
:project
),
group:
try
(
:group
))
get
api
(
route
,
user
),
iids:
[
closed_milestone
.
iid
,
other_milestone
.
iid
]
get
api
(
route
,
user
),
params:
{
iids:
[
closed_milestone
.
iid
,
other_milestone
.
iid
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
@@ -54,7 +54,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
...
@@ -54,7 +54,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
end
end
it
'does not return any milestone if none found'
do
it
'does not return any milestone if none found'
do
get
api
(
route
,
user
),
iids:
[
Milestone
.
maximum
(
:iid
).
succ
]
get
api
(
route
,
user
),
params:
{
iids:
[
Milestone
.
maximum
(
:iid
).
succ
]
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
@@ -73,7 +73,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
...
@@ -73,7 +73,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
end
end
it
'returns a milestone by searching for title'
do
it
'returns a milestone by searching for title'
do
get
api
(
route
,
user
),
search:
'version2'
get
api
(
route
,
user
),
params:
{
search:
'version2'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
...
@@ -83,7 +83,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
...
@@ -83,7 +83,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
end
end
it
'returns a milestones by searching for description'
do
it
'returns a milestones by searching for description'
do
get
api
(
route
,
user
),
search:
'open'
get
api
(
route
,
user
),
params:
{
search:
'open'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
...
@@ -117,7 +117,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
...
@@ -117,7 +117,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
describe
"POST
#{
route_definition
}
"
do
describe
"POST
#{
route_definition
}
"
do
it
'creates a new milestone'
do
it
'creates a new milestone'
do
post
api
(
route
,
user
),
title:
'new milestone'
post
api
(
route
,
user
),
params:
{
title:
'new milestone'
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new milestone'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new milestone'
)
...
@@ -125,8 +125,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
...
@@ -125,8 +125,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
end
end
it
'creates a new milestone with description and dates'
do
it
'creates a new milestone with description and dates'
do
post
api
(
route
,
user
),
post
api
(
route
,
user
),
params:
{
title:
'new milestone'
,
description:
'release'
,
due_date:
'2013-03-02'
,
start_date:
'2013-02-02'
}
title:
'new milestone'
,
description:
'release'
,
due_date:
'2013-03-02'
,
start_date:
'2013-02-02'
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'description'
]).
to
eq
(
'release'
)
expect
(
json_response
[
'description'
]).
to
eq
(
'release'
)
...
@@ -141,14 +140,13 @@ shared_examples_for 'group and project milestones' do |route_definition|
...
@@ -141,14 +140,13 @@ shared_examples_for 'group and project milestones' do |route_definition|
end
end
it
'returns a 400 error if params are invalid (duplicate title)'
do
it
'returns a 400 error if params are invalid (duplicate title)'
do
post
api
(
route
,
user
),
post
api
(
route
,
user
),
params:
{
title:
milestone
.
title
,
description:
'release'
,
due_date:
'2013-03-02'
}
title:
milestone
.
title
,
description:
'release'
,
due_date:
'2013-03-02'
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
400
)
end
end
it
'creates a new milestone with reserved html characters'
do
it
'creates a new milestone with reserved html characters'
do
post
api
(
route
,
user
),
title:
'foo & bar 1.1 -> 2.2'
post
api
(
route
,
user
),
params:
{
title:
'foo & bar 1.1 -> 2.2'
}
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'title'
]).
to
eq
(
'foo & bar 1.1 -> 2.2'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'foo & bar 1.1 -> 2.2'
)
...
@@ -158,8 +156,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
...
@@ -158,8 +156,7 @@ shared_examples_for 'group and project milestones' do |route_definition|
describe
"PUT
#{
route_definition
}
/:milestone_id"
do
describe
"PUT
#{
route_definition
}
/:milestone_id"
do
it
'updates a milestone'
do
it
'updates a milestone'
do
put
api
(
resource_route
,
user
),
put
api
(
resource_route
,
user
),
params:
{
title:
'updated title'
}
title:
'updated title'
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'title'
]).
to
eq
(
'updated title'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'updated title'
)
...
@@ -168,29 +165,27 @@ shared_examples_for 'group and project milestones' do |route_definition|
...
@@ -168,29 +165,27 @@ shared_examples_for 'group and project milestones' do |route_definition|
it
'removes a due date if nil is passed'
do
it
'removes a due date if nil is passed'
do
milestone
.
update!
(
due_date:
"2016-08-05"
)
milestone
.
update!
(
due_date:
"2016-08-05"
)
put
api
(
resource_route
,
user
),
due_date:
nil
put
api
(
resource_route
,
user
),
params:
{
due_date:
nil
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'due_date'
]).
to
be_nil
expect
(
json_response
[
'due_date'
]).
to
be_nil
end
end
it
'returns a 404 error if milestone id not found'
do
it
'returns a 404 error if milestone id not found'
do
put
api
(
"
#{
route
}
/1234"
,
user
),
put
api
(
"
#{
route
}
/1234"
,
user
),
params:
{
title:
'updated title'
}
title:
'updated title'
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
it
'closes milestone'
do
it
'closes milestone'
do
put
api
(
resource_route
,
user
),
put
api
(
resource_route
,
user
),
params:
{
state_event:
'close'
}
state_event:
'close'
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'state'
]).
to
eq
(
'closed'
)
expect
(
json_response
[
'state'
]).
to
eq
(
'closed'
)
end
end
it
'updates milestone with only start date'
do
it
'updates milestone with only start date'
do
put
api
(
resource_route
,
user
),
start_date:
Date
.
tomorrow
put
api
(
resource_route
,
user
),
params:
{
start_date:
Date
.
tomorrow
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
end
...
...
spec/support/api/scopes/read_user_shared_examples.rb
View file @
bf735200
...
@@ -77,7 +77,7 @@ shared_examples_for 'does not allow the "read_user" scope' do
...
@@ -77,7 +77,7 @@ shared_examples_for 'does not allow the "read_user" scope' do
let
(
:token
)
{
create
(
:personal_access_token
,
scopes:
[
'read_user'
],
user:
user
)
}
let
(
:token
)
{
create
(
:personal_access_token
,
scopes:
[
'read_user'
],
user:
user
)
}
it
'returns a "403" response'
do
it
'returns a "403" response'
do
post
api_call
.
call
(
path
,
user
,
personal_access_token:
token
),
attributes_for
(
:user
,
projects_limit:
3
)
post
api_call
.
call
(
path
,
user
,
personal_access_token:
token
),
params:
attributes_for
(
:user
,
projects_limit:
3
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
...
...
spec/support/api/time_tracking_shared_examples.rb
View file @
bf735200
...
@@ -7,13 +7,13 @@ shared_examples 'time tracking endpoints' do |issuable_name|
...
@@ -7,13 +7,13 @@ shared_examples 'time tracking endpoints' do |issuable_name|
describe
"POST /projects/:id/
#{
issuable_collection_name
}
/:
#{
issuable_name
}
_id/time_estimate"
do
describe
"POST /projects/:id/
#{
issuable_collection_name
}
/:
#{
issuable_name
}
_id/time_estimate"
do
context
'with an unauthorized user'
do
context
'with an unauthorized user'
do
subject
{
post
(
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/time_estimate"
,
non_member
),
duration:
'1w'
)
}
subject
{
post
(
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/time_estimate"
,
non_member
),
params:
{
duration:
'1w'
}
)
}
it_behaves_like
'an unauthorized API user'
it_behaves_like
'an unauthorized API user'
end
end
it
"sets the time estimate for
#{
issuable_name
}
"
do
it
"sets the time estimate for
#{
issuable_name
}
"
do
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/time_estimate"
,
user
),
duration:
'1w'
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/time_estimate"
,
user
),
params:
{
duration:
'1w'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'human_time_estimate'
]).
to
eq
(
'1w'
)
expect
(
json_response
[
'human_time_estimate'
]).
to
eq
(
'1w'
)
...
@@ -21,12 +21,12 @@ shared_examples 'time tracking endpoints' do |issuable_name|
...
@@ -21,12 +21,12 @@ shared_examples 'time tracking endpoints' do |issuable_name|
describe
'updating the current estimate'
do
describe
'updating the current estimate'
do
before
do
before
do
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/time_estimate"
,
user
),
duration:
'1w'
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/time_estimate"
,
user
),
params:
{
duration:
'1w'
}
end
end
context
'when duration has a bad format'
do
context
'when duration has a bad format'
do
it
'does not modify the original estimate'
do
it
'does not modify the original estimate'
do
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/time_estimate"
,
user
),
duration:
'foo'
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/time_estimate"
,
user
),
params:
{
duration:
'foo'
}
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
response
).
to
have_gitlab_http_status
(
400
)
expect
(
issuable
.
reload
.
human_time_estimate
).
to
eq
(
'1w'
)
expect
(
issuable
.
reload
.
human_time_estimate
).
to
eq
(
'1w'
)
...
@@ -35,7 +35,7 @@ shared_examples 'time tracking endpoints' do |issuable_name|
...
@@ -35,7 +35,7 @@ shared_examples 'time tracking endpoints' do |issuable_name|
context
'with a valid duration'
do
context
'with a valid duration'
do
it
'updates the estimate'
do
it
'updates the estimate'
do
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/time_estimate"
,
user
),
duration:
'3w1h'
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/time_estimate"
,
user
),
params:
{
duration:
'3w1h'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
issuable
.
reload
.
human_time_estimate
).
to
eq
(
'3w 1h'
)
expect
(
issuable
.
reload
.
human_time_estimate
).
to
eq
(
'3w 1h'
)
...
@@ -62,8 +62,7 @@ shared_examples 'time tracking endpoints' do |issuable_name|
...
@@ -62,8 +62,7 @@ shared_examples 'time tracking endpoints' do |issuable_name|
describe
"POST /projects/:id/
#{
issuable_collection_name
}
/:
#{
issuable_name
}
_id/add_spent_time"
do
describe
"POST /projects/:id/
#{
issuable_collection_name
}
/:
#{
issuable_name
}
_id/add_spent_time"
do
context
'with an unauthorized user'
do
context
'with an unauthorized user'
do
subject
do
subject
do
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/add_spent_time"
,
non_member
),
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/add_spent_time"
,
non_member
),
params:
{
duration:
'2h'
}
duration:
'2h'
end
end
it_behaves_like
'an unauthorized API user'
it_behaves_like
'an unauthorized API user'
...
@@ -72,8 +71,7 @@ shared_examples 'time tracking endpoints' do |issuable_name|
...
@@ -72,8 +71,7 @@ shared_examples 'time tracking endpoints' do |issuable_name|
it
"add spent time for
#{
issuable_name
}
"
do
it
"add spent time for
#{
issuable_name
}
"
do
Timecop
.
travel
(
1
.
minute
.
from_now
)
do
Timecop
.
travel
(
1
.
minute
.
from_now
)
do
expect
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/add_spent_time"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/add_spent_time"
,
user
),
params:
{
duration:
'2h'
}
duration:
'2h'
end
.
to
change
{
issuable
.
reload
.
updated_at
}
end
.
to
change
{
issuable
.
reload
.
updated_at
}
end
end
...
@@ -89,8 +87,7 @@ shared_examples 'time tracking endpoints' do |issuable_name|
...
@@ -89,8 +87,7 @@ shared_examples 'time tracking endpoints' do |issuable_name|
end
.
to
change
{
issuable
.
reload
.
updated_at
}
end
.
to
change
{
issuable
.
reload
.
updated_at
}
end
end
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/add_spent_time"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/add_spent_time"
,
user
),
params:
{
duration:
'-1h'
}
duration:
'-1h'
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'total_time_spent'
]).
to
eq
(
3600
)
expect
(
json_response
[
'total_time_spent'
]).
to
eq
(
3600
)
...
@@ -103,8 +100,7 @@ shared_examples 'time tracking endpoints' do |issuable_name|
...
@@ -103,8 +100,7 @@ shared_examples 'time tracking endpoints' do |issuable_name|
Timecop
.
travel
(
1
.
minute
.
from_now
)
do
Timecop
.
travel
(
1
.
minute
.
from_now
)
do
expect
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/add_spent_time"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/
#{
issuable_collection_name
}
/
#{
issuable
.
iid
}
/add_spent_time"
,
user
),
params:
{
duration:
'-1w'
}
duration:
'-1w'
end
.
not_to
change
{
issuable
.
reload
.
updated_at
}
end
.
not_to
change
{
issuable
.
reload
.
updated_at
}
end
end
...
...
spec/support/controllers/githubish_import_controller_shared_examples.rb
View file @
bf735200
...
@@ -17,7 +17,7 @@ shared_examples 'a GitHub-ish import controller: POST personal_access_token' do
...
@@ -17,7 +17,7 @@ shared_examples 'a GitHub-ish import controller: POST personal_access_token' do
allow_any_instance_of
(
Gitlab
::
LegacyGithubImport
::
Client
)
allow_any_instance_of
(
Gitlab
::
LegacyGithubImport
::
Client
)
.
to
receive
(
:user
).
and_return
(
true
)
.
to
receive
(
:user
).
and_return
(
true
)
post
:personal_access_token
,
p
ersonal_access_token:
token
post
:personal_access_token
,
p
arams:
{
personal_access_token:
token
}
expect
(
session
[
:"
#{
provider
}
_access_token"
]).
to
eq
(
token
)
expect
(
session
[
:"
#{
provider
}
_access_token"
]).
to
eq
(
token
)
expect
(
controller
).
to
redirect_to
(
status_import_url
)
expect
(
controller
).
to
redirect_to
(
status_import_url
)
...
@@ -29,7 +29,7 @@ shared_examples 'a GitHub-ish import controller: POST personal_access_token' do
...
@@ -29,7 +29,7 @@ shared_examples 'a GitHub-ish import controller: POST personal_access_token' do
allow_any_instance_of
(
Gitlab
::
LegacyGithubImport
::
Client
)
allow_any_instance_of
(
Gitlab
::
LegacyGithubImport
::
Client
)
.
to
receive
(
:user
).
and_return
(
true
)
.
to
receive
(
:user
).
and_return
(
true
)
post
:personal_access_token
,
p
ersonal_access_token:
"
#{
token
}
"
post
:personal_access_token
,
p
arams:
{
personal_access_token:
"
#{
token
}
"
}
expect
(
session
[
:"
#{
provider
}
_access_token"
]).
to
eq
(
token
)
expect
(
session
[
:"
#{
provider
}
_access_token"
]).
to
eq
(
token
)
expect
(
controller
).
to
redirect_to
(
status_import_url
)
expect
(
controller
).
to
redirect_to
(
status_import_url
)
...
@@ -214,7 +214,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -214,7 +214,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
expect
(
Gitlab
::
LegacyGithubImport
::
ProjectCreator
)
expect
(
Gitlab
::
LegacyGithubImport
::
ProjectCreator
)
.
to
receive
(
:new
).
and_return
(
double
(
execute:
project
))
.
to
receive
(
:new
).
and_return
(
double
(
execute:
project
))
expect
{
post
:create
,
target_namespace:
provider_repo
.
name
,
format: :json
}.
to
change
(
Namespace
,
:count
).
by
(
1
)
expect
{
post
:create
,
params:
{
target_namespace:
provider_repo
.
name
}
,
format: :json
}.
to
change
(
Namespace
,
:count
).
by
(
1
)
end
end
it
"takes the new namespace"
do
it
"takes the new namespace"
do
...
@@ -222,7 +222,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -222,7 +222,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
provider_repo
.
name
,
an_instance_of
(
Group
),
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
provider_repo
.
name
,
an_instance_of
(
Group
),
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
project
))
.
and_return
(
double
(
execute:
project
))
post
:create
,
target_namespace:
provider_repo
.
name
,
format: :json
post
:create
,
params:
{
target_namespace:
provider_repo
.
name
}
,
format: :json
end
end
end
end
...
@@ -261,7 +261,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -261,7 +261,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
test_namespace
,
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
test_namespace
,
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
project
))
.
and_return
(
double
(
execute:
project
))
post
:create
,
{
target_namespace:
test_namespace
.
name
,
new_name:
test_name
,
format: :json
}
post
:create
,
params:
{
target_namespace:
test_namespace
.
name
,
new_name:
test_name
},
format: :json
end
end
it
'takes the selected name and default namespace'
do
it
'takes the selected name and default namespace'
do
...
@@ -269,7 +269,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -269,7 +269,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
user
.
namespace
,
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
user
.
namespace
,
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
project
))
.
and_return
(
double
(
execute:
project
))
post
:create
,
{
new_name:
test_name
,
format: :json
}
post
:create
,
params:
{
new_name:
test_name
},
format: :json
end
end
end
end
...
@@ -288,7 +288,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -288,7 +288,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
nested_namespace
,
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
nested_namespace
,
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
project
))
.
and_return
(
double
(
execute:
project
))
post
:create
,
{
target_namespace:
nested_namespace
.
full_path
,
new_name:
test_name
,
format: :json
}
post
:create
,
params:
{
target_namespace:
nested_namespace
.
full_path
,
new_name:
test_name
},
format: :json
end
end
end
end
...
@@ -300,7 +300,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -300,7 +300,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
project
))
.
and_return
(
double
(
execute:
project
))
post
:create
,
{
target_namespace:
'foo/bar'
,
new_name:
test_name
,
format: :json
}
post
:create
,
params:
{
target_namespace:
'foo/bar'
,
new_name:
test_name
},
format: :json
end
end
it
'creates the namespaces'
do
it
'creates the namespaces'
do
...
@@ -308,7 +308,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -308,7 +308,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
project
))
.
and_return
(
double
(
execute:
project
))
expect
{
post
:create
,
{
target_namespace:
'foo/bar'
,
new_name:
test_name
,
format: :json
}
}
expect
{
post
:create
,
params:
{
target_namespace:
'foo/bar'
,
new_name:
test_name
},
format: :json
}
.
to
change
{
Namespace
.
count
}.
by
(
2
)
.
to
change
{
Namespace
.
count
}.
by
(
2
)
end
end
...
@@ -317,7 +317,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -317,7 +317,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
project
))
.
and_return
(
double
(
execute:
project
))
post
:create
,
{
target_namespace:
'foo/bar'
,
new_name:
test_name
,
format: :json
}
post
:create
,
params:
{
target_namespace:
'foo/bar'
,
new_name:
test_name
},
format: :json
expect
(
Namespace
.
find_by_path_or_name
(
'bar'
).
parent
.
path
).
to
eq
(
'foo'
)
expect
(
Namespace
.
find_by_path_or_name
(
'bar'
).
parent
.
path
).
to
eq
(
'foo'
)
end
end
...
@@ -336,7 +336,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -336,7 +336,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
project
))
.
and_return
(
double
(
execute:
project
))
post
:create
,
{
target_namespace:
'foo/foobar/bar'
,
new_name:
test_name
,
format: :json
}
post
:create
,
params:
{
target_namespace:
'foo/foobar/bar'
,
new_name:
test_name
},
format: :json
end
end
it
'creates the namespaces'
do
it
'creates the namespaces'
do
...
@@ -344,7 +344,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -344,7 +344,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
project
))
.
and_return
(
double
(
execute:
project
))
expect
{
post
:create
,
{
target_namespace:
'foo/foobar/bar'
,
new_name:
test_name
,
format: :json
}
}
expect
{
post
:create
,
params:
{
target_namespace:
'foo/foobar/bar'
,
new_name:
test_name
},
format: :json
}
.
to
change
{
Namespace
.
count
}.
by
(
2
)
.
to
change
{
Namespace
.
count
}.
by
(
2
)
end
end
...
@@ -353,7 +353,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -353,7 +353,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
user
.
namespace
,
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
user
.
namespace
,
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
build_stubbed
(
:project
)))
.
and_return
(
double
(
execute:
build_stubbed
(
:project
)))
expect
{
post
:create
,
{
target_namespace:
"
#{
user
.
namespace_path
}
/test_group"
,
new_name:
test_name
,
format: :js
}
}
expect
{
post
:create
,
params:
{
target_namespace:
"
#{
user
.
namespace_path
}
/test_group"
,
new_name:
test_name
},
format: :js
}
.
not_to
change
{
Namespace
.
count
}
.
not_to
change
{
Namespace
.
count
}
end
end
end
end
...
@@ -367,7 +367,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -367,7 +367,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
user
.
namespace
,
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
user
.
namespace
,
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
build_stubbed
(
:project
)))
.
and_return
(
double
(
execute:
build_stubbed
(
:project
)))
post
:create
,
{
target_namespace:
'foo/foobar/bar'
,
new_name:
test_name
,
format: :js
}
post
:create
,
params:
{
target_namespace:
'foo/foobar/bar'
,
new_name:
test_name
},
format: :js
end
end
it
'does not create the namespaces'
do
it
'does not create the namespaces'
do
...
@@ -375,7 +375,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -375,7 +375,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
kind_of
(
Namespace
),
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
build_stubbed
(
:project
)))
.
and_return
(
double
(
execute:
build_stubbed
(
:project
)))
expect
{
post
:create
,
{
target_namespace:
'foo/foobar/bar'
,
new_name:
test_name
,
format: :js
}
}
expect
{
post
:create
,
params:
{
target_namespace:
'foo/foobar/bar'
,
new_name:
test_name
},
format: :js
}
.
not_to
change
{
Namespace
.
count
}
.
not_to
change
{
Namespace
.
count
}
end
end
end
end
...
@@ -392,7 +392,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -392,7 +392,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
group
,
user
,
access_params
,
type:
provider
)
.
to
receive
(
:new
).
with
(
provider_repo
,
test_name
,
group
,
user
,
access_params
,
type:
provider
)
.
and_return
(
double
(
execute:
build_stubbed
(
:project
)))
.
and_return
(
double
(
execute:
build_stubbed
(
:project
)))
post
:create
,
{
target_namespace:
'foo'
,
new_name:
test_name
,
format: :js
}
post
:create
,
params:
{
target_namespace:
'foo'
,
new_name:
test_name
},
format: :js
end
end
end
end
...
@@ -400,7 +400,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
...
@@ -400,7 +400,7 @@ shared_examples 'a GitHub-ish import controller: POST create' do
it
'returns 422 response'
do
it
'returns 422 response'
do
other_namespace
=
create
(
:group
,
name:
'other_namespace'
)
other_namespace
=
create
(
:group
,
name:
'other_namespace'
)
post
:create
,
{
target_namespace:
other_namespace
.
name
,
format: :json
}
post
:create
,
params:
{
target_namespace:
other_namespace
.
name
},
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
422
)
expect
(
response
).
to
have_gitlab_http_status
(
422
)
end
end
...
...
spec/support/helpers/git_http_helpers.rb
View file @
bf735200
module
GitHttpHelpers
module
GitHttpHelpers
def
clone_get
(
project
,
options
=
{})
def
clone_get
(
project
,
options
=
{})
get
"/
#{
project
}
/info/refs"
,
{
service:
'git-upload-pack'
},
auth_env
(
*
options
.
values_at
(
:user
,
:password
,
:spnego_request_token
))
get
"/
#{
project
}
/info/refs"
,
params:
{
service:
'git-upload-pack'
},
headers:
auth_env
(
*
options
.
values_at
(
:user
,
:password
,
:spnego_request_token
))
end
end
def
clone_post
(
project
,
options
=
{})
def
clone_post
(
project
,
options
=
{})
post
"/
#{
project
}
/git-upload-pack"
,
{},
auth_env
(
*
options
.
values_at
(
:user
,
:password
,
:spnego_request_token
))
post
"/
#{
project
}
/git-upload-pack"
,
headers:
auth_env
(
*
options
.
values_at
(
:user
,
:password
,
:spnego_request_token
))
end
end
def
push_get
(
project
,
options
=
{})
def
push_get
(
project
,
options
=
{})
get
"/
#{
project
}
/info/refs"
,
{
service:
'git-receive-pack'
},
auth_env
(
*
options
.
values_at
(
:user
,
:password
,
:spnego_request_token
))
get
"/
#{
project
}
/info/refs"
,
params:
{
service:
'git-receive-pack'
},
headers:
auth_env
(
*
options
.
values_at
(
:user
,
:password
,
:spnego_request_token
))
end
end
def
push_post
(
project
,
options
=
{})
def
push_post
(
project
,
options
=
{})
post
"/
#{
project
}
/git-receive-pack"
,
{},
auth_env
(
*
options
.
values_at
(
:user
,
:password
,
:spnego_request_token
))
post
"/
#{
project
}
/git-receive-pack"
,
headers:
auth_env
(
*
options
.
values_at
(
:user
,
:password
,
:spnego_request_token
))
end
end
def
download
(
project
,
user:
nil
,
password:
nil
,
spnego_request_token:
nil
)
def
download
(
project
,
user:
nil
,
password:
nil
,
spnego_request_token:
nil
)
...
...
spec/support/helpers/graphql_helpers.rb
View file @
bf735200
...
@@ -107,7 +107,7 @@ module GraphqlHelpers
...
@@ -107,7 +107,7 @@ module GraphqlHelpers
end
end
def
post_graphql
(
query
,
current_user:
nil
,
variables:
nil
)
def
post_graphql
(
query
,
current_user:
nil
,
variables:
nil
)
post
api
(
'/'
,
current_user
,
version:
'graphql'
),
query:
query
,
variables:
variables
post
api
(
'/'
,
current_user
,
version:
'graphql'
),
params:
{
query:
query
,
variables:
variables
}
end
end
def
post_graphql_mutation
(
mutation
,
current_user:
nil
)
def
post_graphql_mutation
(
mutation
,
current_user:
nil
)
...
...
spec/support/issuables_requiring_filter_shared_examples.rb
View file @
bf735200
...
@@ -10,6 +10,6 @@ shared_examples 'issuables requiring filter' do |action|
...
@@ -10,6 +10,6 @@ shared_examples 'issuables requiring filter' do |action|
it
"loads issuables if at least one filter is set"
do
it
"loads issuables if at least one filter is set"
do
expect_any_instance_of
(
described_class
).
to
receive
(
:issuables_collection
).
and_call_original
expect_any_instance_of
(
described_class
).
to
receive
(
:issuables_collection
).
and_call_original
get
action
,
author_id:
user
.
id
get
action
,
params:
{
author_id:
user
.
id
}
end
end
end
end
spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb
View file @
bf735200
...
@@ -8,8 +8,7 @@ shared_examples 'handle uploads' do
...
@@ -8,8 +8,7 @@ shared_examples 'handle uploads' do
describe
"POST #create"
do
describe
"POST #create"
do
context
'when a user is not authorized to upload a file'
do
context
'when a user is not authorized to upload a file'
do
it
'returns 404 status'
do
it
'returns 404 status'
do
post
:create
,
params
.
merge
(
file:
jpg
,
format: :json
)
post
:create
,
params:
params
.
merge
(
file:
jpg
),
format: :json
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
end
...
@@ -22,7 +21,7 @@ shared_examples 'handle uploads' do
...
@@ -22,7 +21,7 @@ shared_examples 'handle uploads' do
context
"without params['file']"
do
context
"without params['file']"
do
it
"returns an error"
do
it
"returns an error"
do
post
:create
,
params
.
merge
(
format: :json
)
post
:create
,
params
:
params
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
422
)
expect
(
response
).
to
have_gitlab_http_status
(
422
)
end
end
...
@@ -30,7 +29,7 @@ shared_examples 'handle uploads' do
...
@@ -30,7 +29,7 @@ shared_examples 'handle uploads' do
context
'with valid image'
do
context
'with valid image'
do
before
do
before
do
post
:create
,
params
.
merge
(
file:
jpg
,
format: :json
)
post
:create
,
params
:
params
.
merge
(
file:
jpg
),
format: :json
end
end
it
'returns a content with original filename, new link, and correct type.'
do
it
'returns a content with original filename, new link, and correct type.'
do
...
@@ -54,7 +53,7 @@ shared_examples 'handle uploads' do
...
@@ -54,7 +53,7 @@ shared_examples 'handle uploads' do
context
'with valid non-image file'
do
context
'with valid non-image file'
do
before
do
before
do
post
:create
,
params
.
merge
(
file:
txt
,
format: :json
)
post
:create
,
params
:
params
.
merge
(
file:
txt
),
format: :json
end
end
it
'returns a content with original filename, new link, and correct type.'
do
it
'returns a content with original filename, new link, and correct type.'
do
...
@@ -67,7 +66,7 @@ shared_examples 'handle uploads' do
...
@@ -67,7 +66,7 @@ shared_examples 'handle uploads' do
describe
"GET #show"
do
describe
"GET #show"
do
let
(
:show_upload
)
do
let
(
:show_upload
)
do
get
:show
,
params
.
merge
(
secret:
secret
,
filename:
"rails_sample.jpg"
)
get
:show
,
params
:
params
.
merge
(
secret:
secret
,
filename:
"rails_sample.jpg"
)
end
end
before
do
before
do
...
...
spec/support/shared_examples/milestone_tabs_examples.rb
View file @
bf735200
...
@@ -10,7 +10,7 @@ shared_examples 'milestone tabs' do
...
@@ -10,7 +10,7 @@ shared_examples 'milestone tabs' do
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
milestone
.
iid
}
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
milestone
.
iid
}
end
end
get
path
,
params
.
merge
(
extra_params
)
get
path
,
params
:
params
.
merge
(
extra_params
)
end
end
describe
'#merge_requests'
do
describe
'#merge_requests'
do
...
...
spec/support/shared_examples/requests/api/merge_requests_list.rb
View file @
bf735200
...
@@ -123,7 +123,7 @@ shared_examples 'merge requests list' do
...
@@ -123,7 +123,7 @@ shared_examples 'merge requests list' do
end
end
it
'returns an empty array if no issue matches milestone'
do
it
'returns an empty array if no issue matches milestone'
do
get
api
(
endpoint_path
,
user
),
milestone:
'1.0.0'
get
api
(
endpoint_path
,
user
),
params:
{
milestone:
'1.0.0'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
@@ -131,7 +131,7 @@ shared_examples 'merge requests list' do
...
@@ -131,7 +131,7 @@ shared_examples 'merge requests list' do
end
end
it
'returns an empty array if milestone does not exist'
do
it
'returns an empty array if milestone does not exist'
do
get
api
(
endpoint_path
,
user
),
milestone:
'foo'
get
api
(
endpoint_path
,
user
),
params:
{
milestone:
'foo'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
@@ -139,7 +139,7 @@ shared_examples 'merge requests list' do
...
@@ -139,7 +139,7 @@ shared_examples 'merge requests list' do
end
end
it
'returns an array of merge requests in given milestone'
do
it
'returns an array of merge requests in given milestone'
do
get
api
(
endpoint_path
,
user
),
milestone:
'0.9'
get
api
(
endpoint_path
,
user
),
params:
{
milestone:
'0.9'
}
closed_issues
=
json_response
.
select
{
|
mr
|
mr
[
'id'
]
==
merge_request_closed
.
id
}
closed_issues
=
json_response
.
select
{
|
mr
|
mr
[
'id'
]
==
merge_request_closed
.
id
}
expect
(
closed_issues
.
length
).
to
eq
(
1
)
expect
(
closed_issues
.
length
).
to
eq
(
1
)
...
@@ -147,7 +147,7 @@ shared_examples 'merge requests list' do
...
@@ -147,7 +147,7 @@ shared_examples 'merge requests list' do
end
end
it
'returns an array of merge requests matching state in milestone'
do
it
'returns an array of merge requests matching state in milestone'
do
get
api
(
endpoint_path
,
user
),
milestone:
'0.9'
,
state:
'closed'
get
api
(
endpoint_path
,
user
),
params:
{
milestone:
'0.9'
,
state:
'closed'
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
...
@@ -187,7 +187,7 @@ shared_examples 'merge requests list' do
...
@@ -187,7 +187,7 @@ shared_examples 'merge requests list' do
end
end
it
'returns an array of merge requests with any label when filtering by any label'
do
it
'returns an array of merge requests with any label when filtering by any label'
do
get
api
(
endpoint_path
,
user
),
labels:
IssuesFinder
::
FILTER_ANY
get
api
(
endpoint_path
,
user
),
params:
{
labels:
IssuesFinder
::
FILTER_ANY
}
expect_paginated_array_response
expect_paginated_array_response
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
length
).
to
eq
(
1
)
...
@@ -195,7 +195,7 @@ shared_examples 'merge requests list' do
...
@@ -195,7 +195,7 @@ shared_examples 'merge requests list' do
end
end
it
'returns an array of merge requests without a label when filtering by no label'
do
it
'returns an array of merge requests without a label when filtering by no label'
do
get
api
(
endpoint_path
,
user
),
labels:
IssuesFinder
::
FILTER_NONE
get
api
(
endpoint_path
,
user
),
params:
{
labels:
IssuesFinder
::
FILTER_NONE
}
response_ids
=
json_response
.
map
{
|
merge_request
|
merge_request
[
'id'
]
}
response_ids
=
json_response
.
map
{
|
merge_request
|
merge_request
[
'id'
]
}
...
@@ -286,7 +286,7 @@ shared_examples 'merge requests list' do
...
@@ -286,7 +286,7 @@ shared_examples 'merge requests list' do
context
'source_branch param'
do
context
'source_branch param'
do
it
'returns merge requests with the given source branch'
do
it
'returns merge requests with the given source branch'
do
get
api
(
endpoint_path
,
user
),
source_branch:
merge_request_closed
.
source_branch
,
state:
'all'
get
api
(
endpoint_path
,
user
),
params:
{
source_branch:
merge_request_closed
.
source_branch
,
state:
'all'
}
expect_response_contain_exactly
(
merge_request_closed
,
merge_request_merged
,
merge_request_locked
)
expect_response_contain_exactly
(
merge_request_closed
,
merge_request_merged
,
merge_request_locked
)
end
end
...
@@ -294,7 +294,7 @@ shared_examples 'merge requests list' do
...
@@ -294,7 +294,7 @@ shared_examples 'merge requests list' do
context
'target_branch param'
do
context
'target_branch param'
do
it
'returns merge requests with the given target branch'
do
it
'returns merge requests with the given target branch'
do
get
api
(
endpoint_path
,
user
),
target_branch:
merge_request_closed
.
target_branch
,
state:
'all'
get
api
(
endpoint_path
,
user
),
params:
{
target_branch:
merge_request_closed
.
target_branch
,
state:
'all'
}
expect_response_contain_exactly
(
merge_request_closed
,
merge_request_merged
,
merge_request_locked
)
expect_response_contain_exactly
(
merge_request_closed
,
merge_request_merged
,
merge_request_locked
)
end
end
...
...
spec/support/shared_examples/requests/api/notes.rb
View file @
bf735200
...
@@ -118,7 +118,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
...
@@ -118,7 +118,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
context
'by an admin'
do
context
'by an admin'
do
it
'sets the creation time on the new note'
do
it
'sets the creation time on the new note'
do
admin
=
create
(
:admin
)
admin
=
create
(
:admin
)
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
admin
),
params
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
admin
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
...
@@ -131,7 +131,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
...
@@ -131,7 +131,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
if
parent_type
==
'projects'
if
parent_type
==
'projects'
context
'by a project owner'
do
context
'by a project owner'
do
it
'sets the creation time on the new note'
do
it
'sets the creation time on the new note'
do
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
user
),
params
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
user
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
...
@@ -149,7 +149,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
...
@@ -149,7 +149,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
parent
.
update!
(
namespace:
group
)
parent
.
update!
(
namespace:
group
)
user2
.
refresh_authorized_projects
user2
.
refresh_authorized_projects
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
user2
),
params
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
user2
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
...
@@ -161,7 +161,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
...
@@ -161,7 +161,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
elsif
parent_type
==
'groups'
elsif
parent_type
==
'groups'
context
'by a group owner'
do
context
'by a group owner'
do
it
'sets the creation time on the new note'
do
it
'sets the creation time on the new note'
do
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
user
),
params
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
user
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
...
@@ -176,7 +176,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
...
@@ -176,7 +176,7 @@ shared_examples 'noteable API' do |parent_type, noteable_type, id_name|
it
'ignores the given creation time'
do
it
'ignores the given creation time'
do
user2
=
create
(
:user
)
user2
=
create
(
:user
)
parent
.
add_developer
(
user2
)
parent
.
add_developer
(
user2
)
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
user2
),
params
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/notes"
,
user2
),
params
:
params
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
expect
(
json_response
[
'body'
]).
to
eq
(
'hi!'
)
...
...
spec/support/shared_examples/requests/api/resolvable_discussions.rb
View file @
bf735200
...
@@ -2,7 +2,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
...
@@ -2,7 +2,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
describe
"PUT /
#{
parent_type
}
/:id/
#{
noteable_type
}
/:noteable_id/discussions/:discussion_id"
do
describe
"PUT /
#{
parent_type
}
/:id/
#{
noteable_type
}
/:noteable_id/discussions/:discussion_id"
do
it
"resolves discussion if resolved is true"
do
it
"resolves discussion if resolved is true"
do
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
"discussions/
#{
note
.
discussion_id
}
"
,
user
),
resolved:
true
"discussions/
#{
note
.
discussion_id
}
"
,
user
),
params:
{
resolved:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'notes'
].
size
).
to
eq
(
1
)
expect
(
json_response
[
'notes'
].
size
).
to
eq
(
1
)
...
@@ -11,7 +11,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
...
@@ -11,7 +11,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
it
"unresolves discussion if resolved is false"
do
it
"unresolves discussion if resolved is false"
do
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
"discussions/
#{
note
.
discussion_id
}
"
,
user
),
resolved:
false
"discussions/
#{
note
.
discussion_id
}
"
,
user
),
params:
{
resolved:
false
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'notes'
].
size
).
to
eq
(
1
)
expect
(
json_response
[
'notes'
].
size
).
to
eq
(
1
)
...
@@ -27,14 +27,14 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
...
@@ -27,14 +27,14 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
it
"returns a 401 unauthorized error if user is not authenticated"
do
it
"returns a 401 unauthorized error if user is not authenticated"
do
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
"discussions/
#{
note
.
discussion_id
}
"
),
resolved:
true
"discussions/
#{
note
.
discussion_id
}
"
),
params:
{
resolved:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
401
)
expect
(
response
).
to
have_gitlab_http_status
(
401
)
end
end
it
"returns a 403 error if user resolves discussion of someone else"
do
it
"returns a 403 error if user resolves discussion of someone else"
do
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
"discussions/
#{
note
.
discussion_id
}
"
,
private_user
),
resolved:
true
"discussions/
#{
note
.
discussion_id
}
"
,
private_user
),
params:
{
resolved:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
...
@@ -46,7 +46,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
...
@@ -46,7 +46,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
it
'responds with 404'
do
it
'responds with 404'
do
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
"discussions/
#{
note
.
discussion_id
}
"
,
private_user
),
resolved:
true
"discussions/
#{
note
.
discussion_id
}
"
,
private_user
),
params:
{
resolved:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
...
@@ -56,7 +56,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
...
@@ -56,7 +56,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
describe
"PUT /
#{
parent_type
}
/:id/
#{
noteable_type
}
/:noteable_id/discussions/:discussion_id/notes/:note_id"
do
describe
"PUT /
#{
parent_type
}
/:id/
#{
noteable_type
}
/:noteable_id/discussions/:discussion_id/notes/:note_id"
do
it
'returns resolved note when resolved parameter is true'
do
it
'returns resolved note when resolved parameter is true'
do
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
"discussions/
#{
note
.
discussion_id
}
/notes/
#{
note
.
id
}
"
,
user
),
resolved:
true
"discussions/
#{
note
.
discussion_id
}
/notes/
#{
note
.
id
}
"
,
user
),
params:
{
resolved:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'resolved'
]).
to
eq
(
true
)
expect
(
json_response
[
'resolved'
]).
to
eq
(
true
)
...
@@ -79,7 +79,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
...
@@ -79,7 +79,7 @@ shared_examples 'resolvable discussions API' do |parent_type, noteable_type, id_
it
"returns a 403 error if user resolves note of someone else"
do
it
"returns a 403 error if user resolves note of someone else"
do
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
put
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/"
\
"discussions/
#{
note
.
discussion_id
}
/notes/
#{
note
.
id
}
"
,
private_user
),
resolved:
true
"discussions/
#{
note
.
discussion_id
}
/notes/
#{
note
.
id
}
"
,
private_user
),
params:
{
resolved:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
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