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
e47d2229
Commit
e47d2229
authored
Apr 28, 2020
by
Robert May
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Autocorrect Gitlab/Json cop in /app, /spec
Applies Gitlab/Json cop autocorrections to /app and /spec directories.
parent
4f46a580
Changes
41
Show whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
61 additions
and
61 deletions
+61
-61
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+1
-1
app/controllers/import/google_code_controller.rb
app/controllers/import/google_code_controller.rb
+2
-2
app/helpers/icons_helper.rb
app/helpers/icons_helper.rb
+1
-1
app/models/blob_viewer/dependency_manager.rb
app/models/blob_viewer/dependency_manager.rb
+1
-1
app/models/concerns/diff_positionable_note.rb
app/models/concerns/diff_positionable_note.rb
+1
-1
app/models/concerns/redis_cacheable.rb
app/models/concerns/redis_cacheable.rb
+1
-1
app/models/project_services/mock_monitoring_service.rb
app/models/project_services/mock_monitoring_service.rb
+1
-1
app/models/sent_notification.rb
app/models/sent_notification.rb
+1
-1
app/services/metrics/dashboard/grafana_metric_embed_service.rb
...ervices/metrics/dashboard/grafana_metric_embed_service.rb
+1
-1
app/services/metrics/dashboard/transient_embed_service.rb
app/services/metrics/dashboard/transient_embed_service.rb
+1
-1
app/services/projects/lfs_pointers/lfs_download_link_list_service.rb
...s/projects/lfs_pointers/lfs_download_link_list_service.rb
+1
-1
app/services/projects/lsif_data_service.rb
app/services/projects/lsif_data_service.rb
+1
-1
app/workers/irker_worker.rb
app/workers/irker_worker.rb
+1
-1
spec/controllers/oauth/token_info_controller_spec.rb
spec/controllers/oauth/token_info_controller_spec.rb
+5
-5
spec/controllers/projects/artifacts_controller_spec.rb
spec/controllers/projects/artifacts_controller_spec.rb
+1
-1
spec/controllers/projects/cycle_analytics/events_controller_spec.rb
...ollers/projects/cycle_analytics/events_controller_spec.rb
+3
-3
spec/controllers/projects/environments/prometheus_api_controller_spec.rb
...s/projects/environments/prometheus_api_controller_spec.rb
+1
-1
spec/controllers/projects/logs_controller_spec.rb
spec/controllers/projects/logs_controller_spec.rb
+1
-1
spec/features/error_tracking/user_filters_errors_by_status_spec.rb
...ures/error_tracking/user_filters_errors_by_status_spec.rb
+1
-1
spec/features/error_tracking/user_sees_error_index_spec.rb
spec/features/error_tracking/user_sees_error_index_spec.rb
+1
-1
spec/features/projects/import_export/export_file_spec.rb
spec/features/projects/import_export/export_file_spec.rb
+2
-2
spec/features/projects/settings/operations_settings_spec.rb
spec/features/projects/settings/operations_settings_spec.rb
+1
-1
spec/helpers/todos_helper_spec.rb
spec/helpers/todos_helper_spec.rb
+1
-1
spec/initializers/lograge_spec.rb
spec/initializers/lograge_spec.rb
+1
-1
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+1
-1
spec/models/container_repository_spec.rb
spec/models/container_repository_spec.rb
+1
-1
spec/models/project_services/irker_service_spec.rb
spec/models/project_services/irker_service_spec.rb
+1
-1
spec/models/snippet_spec.rb
spec/models/snippet_spec.rb
+2
-2
spec/requests/api/graphql/boards/board_lists_query_spec.rb
spec/requests/api/graphql/boards/board_lists_query_spec.rb
+1
-1
spec/requests/api/graphql/project/issues_spec.rb
spec/requests/api/graphql/project/issues_spec.rb
+5
-5
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+2
-2
spec/services/metrics/dashboard/grafana_metric_embed_service_spec.rb
...es/metrics/dashboard/grafana_metric_embed_service_spec.rb
+1
-1
spec/support/helpers/stub_gitlab_calls.rb
spec/support/helpers/stub_gitlab_calls.rb
+4
-4
spec/support/helpers/workhorse_helpers.rb
spec/support/helpers/workhorse_helpers.rb
+1
-1
spec/support/import_export/configuration_helper.rb
spec/support/import_export/configuration_helper.rb
+2
-2
spec/support/matchers/disallow_request_matchers.rb
spec/support/matchers/disallow_request_matchers.rb
+1
-1
spec/support/shared_contexts/features/error_tracking_shared_context.rb
...shared_contexts/features/error_tracking_shared_context.rb
+2
-2
spec/support/shared_contexts/json_response_shared_context.rb
spec/support/shared_contexts/json_response_shared_context.rb
+1
-1
spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb
...xamples/graphql/sorted_paginated_query_shared_examples.rb
+1
-1
spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb
...graphql/group_and_project_boards_query_shared_examples.rb
+1
-1
spec/support/shared_examples/services/metrics/dashboard_shared_examples.rb
...ed_examples/services/metrics/dashboard_shared_examples.rb
+2
-2
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
e47d2229
...
@@ -43,7 +43,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
...
@@ -43,7 +43,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
def
usage_data
def
usage_data
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
usage_data_json
=
JSON
.
pretty_generate
(
Gitlab
::
UsageData
.
data
)
usage_data_json
=
Gitlab
::
Json
.
pretty_generate
(
Gitlab
::
UsageData
.
data
)
render
html:
Gitlab
::
Highlight
.
highlight
(
'payload.json'
,
usage_data_json
,
language:
'json'
)
render
html:
Gitlab
::
Highlight
.
highlight
(
'payload.json'
,
usage_data_json
,
language:
'json'
)
end
end
...
...
app/controllers/import/google_code_controller.rb
View file @
e47d2229
...
@@ -15,7 +15,7 @@ class Import::GoogleCodeController < Import::BaseController
...
@@ -15,7 +15,7 @@ class Import::GoogleCodeController < Import::BaseController
end
end
begin
begin
dump
=
JSON
.
parse
(
dump_file
.
read
)
dump
=
Gitlab
::
Json
.
parse
(
dump_file
.
read
)
rescue
rescue
return
redirect_back_or_default
(
options:
{
alert:
_
(
"The uploaded file is not a valid Google Takeout archive."
)
})
return
redirect_back_or_default
(
options:
{
alert:
_
(
"The uploaded file is not a valid Google Takeout archive."
)
})
end
end
...
@@ -42,7 +42,7 @@ class Import::GoogleCodeController < Import::BaseController
...
@@ -42,7 +42,7 @@ class Import::GoogleCodeController < Import::BaseController
user_map_json
=
"{}"
if
user_map_json
.
blank?
user_map_json
=
"{}"
if
user_map_json
.
blank?
begin
begin
user_map
=
JSON
.
parse
(
user_map_json
)
user_map
=
Gitlab
::
Json
.
parse
(
user_map_json
)
rescue
rescue
flash
.
now
[
:alert
]
=
_
(
"The entered user map is not a valid JSON user map."
)
flash
.
now
[
:alert
]
=
_
(
"The entered user map is not a valid JSON user map."
)
...
...
app/helpers/icons_helper.rb
View file @
e47d2229
...
@@ -158,6 +158,6 @@ module IconsHelper
...
@@ -158,6 +158,6 @@ module IconsHelper
def
known_sprites
def
known_sprites
return
if
Rails
.
env
.
production?
return
if
Rails
.
env
.
production?
@known_sprites
||=
JSON
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
'node_modules/@gitlab/svgs/dist/icons.json'
)))[
'icons'
]
@known_sprites
||=
Gitlab
::
Json
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
'node_modules/@gitlab/svgs/dist/icons.json'
)))[
'icons'
]
end
end
end
end
app/models/blob_viewer/dependency_manager.rb
View file @
e47d2229
...
@@ -32,7 +32,7 @@ module BlobViewer
...
@@ -32,7 +32,7 @@ module BlobViewer
def
json_data
def
json_data
@json_data
||=
begin
@json_data
||=
begin
prepare!
prepare!
JSON
.
parse
(
blob
.
data
)
Gitlab
::
Json
.
parse
(
blob
.
data
)
rescue
rescue
{}
{}
end
end
...
...
app/models/concerns/diff_positionable_note.rb
View file @
e47d2229
...
@@ -17,7 +17,7 @@ module DiffPositionableNote
...
@@ -17,7 +17,7 @@ module DiffPositionableNote
%i(original_position position change_position)
.
each
do
|
meth
|
%i(original_position position change_position)
.
each
do
|
meth
|
define_method
"
#{
meth
}
="
do
|
new_position
|
define_method
"
#{
meth
}
="
do
|
new_position
|
if
new_position
.
is_a?
(
String
)
if
new_position
.
is_a?
(
String
)
new_position
=
JSON
.
parse
(
new_position
)
rescue
nil
new_position
=
Gitlab
::
Json
.
parse
(
new_position
)
rescue
nil
end
end
if
new_position
.
is_a?
(
Hash
)
if
new_position
.
is_a?
(
Hash
)
...
...
app/models/concerns/redis_cacheable.rb
View file @
e47d2229
...
@@ -43,7 +43,7 @@ module RedisCacheable
...
@@ -43,7 +43,7 @@ module RedisCacheable
strong_memoize
(
:cached_attributes
)
do
strong_memoize
(
:cached_attributes
)
do
Gitlab
::
Redis
::
Cache
.
with
do
|
redis
|
Gitlab
::
Redis
::
Cache
.
with
do
|
redis
|
data
=
redis
.
get
(
cache_attribute_key
)
data
=
redis
.
get
(
cache_attribute_key
)
JSON
.
parse
(
data
,
symbolize_names:
true
)
if
data
Gitlab
::
Json
.
parse
(
data
,
symbolize_names:
true
)
if
data
end
end
end
end
end
end
...
...
app/models/project_services/mock_monitoring_service.rb
View file @
e47d2229
...
@@ -14,7 +14,7 @@ class MockMonitoringService < MonitoringService
...
@@ -14,7 +14,7 @@ class MockMonitoringService < MonitoringService
end
end
def
metrics
(
environment
)
def
metrics
(
environment
)
JSON
.
parse
(
File
.
read
(
Rails
.
root
+
'spec/fixtures/metrics.json'
))
Gitlab
::
Json
.
parse
(
File
.
read
(
Rails
.
root
+
'spec/fixtures/metrics.json'
))
end
end
def
can_test?
def
can_test?
...
...
app/models/sent_notification.rb
View file @
e47d2229
...
@@ -76,7 +76,7 @@ class SentNotification < ApplicationRecord
...
@@ -76,7 +76,7 @@ class SentNotification < ApplicationRecord
def
position
=
(
new_position
)
def
position
=
(
new_position
)
if
new_position
.
is_a?
(
String
)
if
new_position
.
is_a?
(
String
)
new_position
=
JSON
.
parse
(
new_position
)
rescue
nil
new_position
=
Gitlab
::
Json
.
parse
(
new_position
)
rescue
nil
end
end
if
new_position
.
is_a?
(
Hash
)
if
new_position
.
is_a?
(
Hash
)
...
...
app/services/metrics/dashboard/grafana_metric_embed_service.rb
View file @
e47d2229
...
@@ -113,7 +113,7 @@ module Metrics
...
@@ -113,7 +113,7 @@ module Metrics
end
end
def
parse_json
(
json
)
def
parse_json
(
json
)
JSON
.
parse
(
json
,
symbolize_names:
true
)
Gitlab
::
Json
.
parse
(
json
,
symbolize_names:
true
)
rescue
JSON
::
ParserError
rescue
JSON
::
ParserError
raise
DashboardProcessingError
.
new
(
'Grafana response contains invalid json'
)
raise
DashboardProcessingError
.
new
(
'Grafana response contains invalid json'
)
end
end
...
...
app/services/metrics/dashboard/transient_embed_service.rb
View file @
e47d2229
...
@@ -23,7 +23,7 @@ module Metrics
...
@@ -23,7 +23,7 @@ module Metrics
override
:get_raw_dashboard
override
:get_raw_dashboard
def
get_raw_dashboard
def
get_raw_dashboard
JSON
.
parse
(
params
[
:embed_json
])
Gitlab
::
Json
.
parse
(
params
[
:embed_json
])
rescue
JSON
::
ParserError
=>
e
rescue
JSON
::
ParserError
=>
e
invalid_embed_json!
(
e
.
message
)
invalid_embed_json!
(
e
.
message
)
end
end
...
...
app/services/projects/lfs_pointers/lfs_download_link_list_service.rb
View file @
e47d2229
...
@@ -69,7 +69,7 @@ module Projects
...
@@ -69,7 +69,7 @@ module Projects
# application/vnd.git-lfs+json
# application/vnd.git-lfs+json
# (https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md#requests),
# (https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md#requests),
# HTTParty does not know this is actually JSON.
# HTTParty does not know this is actually JSON.
data
=
JSON
.
parse
(
response
.
body
)
data
=
Gitlab
::
Json
.
parse
(
response
.
body
)
raise
DownloadLinksError
,
"LFS Batch API did return any objects"
unless
data
.
is_a?
(
Hash
)
&&
data
.
key?
(
'objects'
)
raise
DownloadLinksError
,
"LFS Batch API did return any objects"
unless
data
.
is_a?
(
Hash
)
&&
data
.
key?
(
'objects'
)
...
...
app/services/projects/lsif_data_service.rb
View file @
e47d2229
...
@@ -42,7 +42,7 @@ module Projects
...
@@ -42,7 +42,7 @@ module Projects
file
.
open
do
|
stream
|
file
.
open
do
|
stream
|
Zlib
::
GzipReader
.
wrap
(
stream
)
do
|
gz_stream
|
Zlib
::
GzipReader
.
wrap
(
stream
)
do
|
gz_stream
|
data
=
JSON
.
parse
(
gz_stream
.
read
)
data
=
Gitlab
::
Json
.
parse
(
gz_stream
.
read
)
end
end
end
end
...
...
app/workers/irker_worker.rb
View file @
e47d2229
...
@@ -53,7 +53,7 @@ class IrkerWorker # rubocop:disable Scalability/IdempotentWorker
...
@@ -53,7 +53,7 @@ class IrkerWorker # rubocop:disable Scalability/IdempotentWorker
def
sendtoirker
(
privmsg
)
def
sendtoirker
(
privmsg
)
to_send
=
{
to:
@channels
,
privmsg:
privmsg
}
to_send
=
{
to:
@channels
,
privmsg:
privmsg
}
@socket
.
puts
JSON
.
dump
(
to_send
)
@socket
.
puts
Gitlab
::
Json
.
dump
(
to_send
)
end
end
def
close_connection
def
close_connection
...
...
spec/controllers/oauth/token_info_controller_spec.rb
View file @
e47d2229
...
@@ -9,7 +9,7 @@ RSpec.describe Oauth::TokenInfoController do
...
@@ -9,7 +9,7 @@ RSpec.describe Oauth::TokenInfoController do
get
:show
get
:show
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
JSON
.
parse
(
response
.
body
)).
to
include
(
'error'
=>
'invalid_request'
)
expect
(
Gitlab
::
Json
.
parse
(
response
.
body
)).
to
include
(
'error'
=>
'invalid_request'
)
end
end
end
end
...
@@ -23,7 +23,7 @@ RSpec.describe Oauth::TokenInfoController do
...
@@ -23,7 +23,7 @@ RSpec.describe Oauth::TokenInfoController do
get
:show
,
params:
{
access_token:
access_token
.
token
}
get
:show
,
params:
{
access_token:
access_token
.
token
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
JSON
.
parse
(
response
.
body
)).
to
eq
(
expect
(
Gitlab
::
Json
.
parse
(
response
.
body
)).
to
eq
(
'scope'
=>
%w[api]
,
'scope'
=>
%w[api]
,
'scopes'
=>
%w[api]
,
'scopes'
=>
%w[api]
,
'created_at'
=>
access_token
.
created_at
.
to_i
,
'created_at'
=>
access_token
.
created_at
.
to_i
,
...
@@ -40,7 +40,7 @@ RSpec.describe Oauth::TokenInfoController do
...
@@ -40,7 +40,7 @@ RSpec.describe Oauth::TokenInfoController do
get
:show
,
params:
{
access_token:
'unknown_token'
}
get
:show
,
params:
{
access_token:
'unknown_token'
}
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
JSON
.
parse
(
response
.
body
)).
to
include
(
'error'
=>
'invalid_request'
)
expect
(
Gitlab
::
Json
.
parse
(
response
.
body
)).
to
include
(
'error'
=>
'invalid_request'
)
end
end
end
end
...
@@ -53,7 +53,7 @@ RSpec.describe Oauth::TokenInfoController do
...
@@ -53,7 +53,7 @@ RSpec.describe Oauth::TokenInfoController do
get
:show
,
params:
{
access_token:
access_token
.
token
}
get
:show
,
params:
{
access_token:
access_token
.
token
}
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
JSON
.
parse
(
response
.
body
)).
to
include
(
'error'
=>
'invalid_request'
)
expect
(
Gitlab
::
Json
.
parse
(
response
.
body
)).
to
include
(
'error'
=>
'invalid_request'
)
end
end
end
end
...
@@ -64,7 +64,7 @@ RSpec.describe Oauth::TokenInfoController do
...
@@ -64,7 +64,7 @@ RSpec.describe Oauth::TokenInfoController do
get
:show
,
params:
{
access_token:
access_token
.
token
}
get
:show
,
params:
{
access_token:
access_token
.
token
}
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
JSON
.
parse
(
response
.
body
)).
to
include
(
'error'
=>
'invalid_request'
)
expect
(
Gitlab
::
Json
.
parse
(
response
.
body
)).
to
include
(
'error'
=>
'invalid_request'
)
end
end
end
end
end
end
...
...
spec/controllers/projects/artifacts_controller_spec.rb
View file @
e47d2229
...
@@ -334,7 +334,7 @@ describe Projects::ArtifactsController do
...
@@ -334,7 +334,7 @@ describe Projects::ArtifactsController do
def
params
def
params
@params
||=
begin
@params
||=
begin
base64_params
=
send_data
.
sub
(
/\Aartifacts\-entry:/
,
''
)
base64_params
=
send_data
.
sub
(
/\Aartifacts\-entry:/
,
''
)
JSON
.
parse
(
Base64
.
urlsafe_decode64
(
base64_params
))
Gitlab
::
Json
.
parse
(
Base64
.
urlsafe_decode64
(
base64_params
))
end
end
end
end
end
end
...
...
spec/controllers/projects/cycle_analytics/events_controller_spec.rb
View file @
e47d2229
...
@@ -17,7 +17,7 @@ describe Projects::CycleAnalytics::EventsController do
...
@@ -17,7 +17,7 @@ describe Projects::CycleAnalytics::EventsController do
get_issue
get_issue
expect
(
response
).
to
be_successful
expect
(
response
).
to
be_successful
expect
(
JSON
.
parse
(
response
.
body
)[
'events'
]).
to
be_empty
expect
(
Gitlab
::
Json
.
parse
(
response
.
body
)[
'events'
]).
to
be_empty
end
end
end
end
...
@@ -38,7 +38,7 @@ describe Projects::CycleAnalytics::EventsController do
...
@@ -38,7 +38,7 @@ describe Projects::CycleAnalytics::EventsController do
it
'contains event detais'
do
it
'contains event detais'
do
get_issue
get_issue
events
=
JSON
.
parse
(
response
.
body
)[
'events'
]
events
=
Gitlab
::
Json
.
parse
(
response
.
body
)[
'events'
]
expect
(
events
).
not_to
be_empty
expect
(
events
).
not_to
be_empty
expect
(
events
.
first
).
to
include
(
'title'
,
'author'
,
'iid'
,
'total_time'
,
'created_at'
,
'url'
)
expect
(
events
.
first
).
to
include
(
'title'
,
'author'
,
'iid'
,
'total_time'
,
'created_at'
,
'url'
)
...
@@ -51,7 +51,7 @@ describe Projects::CycleAnalytics::EventsController do
...
@@ -51,7 +51,7 @@ describe Projects::CycleAnalytics::EventsController do
expect
(
response
).
to
be_successful
expect
(
response
).
to
be_successful
expect
(
JSON
.
parse
(
response
.
body
)[
'events'
]).
to
be_empty
expect
(
Gitlab
::
Json
.
parse
(
response
.
body
)[
'events'
]).
to
be_empty
end
end
end
end
end
end
...
...
spec/controllers/projects/environments/prometheus_api_controller_spec.rb
View file @
e47d2229
...
@@ -38,7 +38,7 @@ describe Projects::Environments::PrometheusApiController do
...
@@ -38,7 +38,7 @@ describe Projects::Environments::PrometheusApiController do
context
'with success result'
do
context
'with success result'
do
let
(
:service_result
)
{
{
status: :success
,
body:
prometheus_body
}
}
let
(
:service_result
)
{
{
status: :success
,
body:
prometheus_body
}
}
let
(
:prometheus_body
)
{
'{"status":"success"}'
}
let
(
:prometheus_body
)
{
'{"status":"success"}'
}
let
(
:prometheus_json_body
)
{
JSON
.
parse
(
prometheus_body
)
}
let
(
:prometheus_json_body
)
{
Gitlab
::
Json
.
parse
(
prometheus_body
)
}
it
'returns prometheus response'
do
it
'returns prometheus response'
do
get
:proxy
,
params:
environment_params
get
:proxy
,
params:
environment_params
...
...
spec/controllers/projects/logs_controller_spec.rb
View file @
e47d2229
...
@@ -50,7 +50,7 @@ describe Projects::LogsController do
...
@@ -50,7 +50,7 @@ describe Projects::LogsController do
container_name:
container
container_name:
container
}
}
end
end
let
(
:service_result_json
)
{
JSON
.
parse
(
service_result
.
to_json
)
}
let
(
:service_result_json
)
{
Gitlab
::
Json
.
parse
(
service_result
.
to_json
)
}
let_it_be
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
environment_scope:
'*'
,
projects:
[
project
])
}
let_it_be
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
environment_scope:
'*'
,
projects:
[
project
])
}
...
...
spec/features/error_tracking/user_filters_errors_by_status_spec.rb
View file @
e47d2229
...
@@ -6,7 +6,7 @@ describe 'When a user filters Sentry errors by status', :js, :use_clean_rails_me
...
@@ -6,7 +6,7 @@ describe 'When a user filters Sentry errors by status', :js, :use_clean_rails_me
include_context
'sentry error tracking context feature'
include_context
'sentry error tracking context feature'
let_it_be
(
:issues_response_body
)
{
fixture_file
(
'sentry/issues_sample_response.json'
)
}
let_it_be
(
:issues_response_body
)
{
fixture_file
(
'sentry/issues_sample_response.json'
)
}
let_it_be
(
:filtered_errors_by_status_response
)
{
JSON
.
parse
(
issues_response_body
).
filter
{
|
error
|
error
[
'status'
]
==
'ignored'
}.
to_json
}
let_it_be
(
:filtered_errors_by_status_response
)
{
Gitlab
::
Json
.
parse
(
issues_response_body
).
filter
{
|
error
|
error
[
'status'
]
==
'ignored'
}.
to_json
}
let
(
:issues_api_url
)
{
"
#{
sentry_api_urls
.
issues_url
}
?limit=20&query=is:unresolved"
}
let
(
:issues_api_url
)
{
"
#{
sentry_api_urls
.
issues_url
}
?limit=20&query=is:unresolved"
}
let
(
:issues_api_url_filter
)
{
"
#{
sentry_api_urls
.
issues_url
}
?limit=20&query=is:ignored"
}
let
(
:issues_api_url_filter
)
{
"
#{
sentry_api_urls
.
issues_url
}
?limit=20&query=is:ignored"
}
let
(
:auth_token
)
{{
'Authorization'
=>
'Bearer access_token_123'
}}
let
(
:auth_token
)
{{
'Authorization'
=>
'Bearer access_token_123'
}}
...
...
spec/features/error_tracking/user_sees_error_index_spec.rb
View file @
e47d2229
...
@@ -6,7 +6,7 @@ describe 'View error index page', :js, :use_clean_rails_memory_store_caching, :s
...
@@ -6,7 +6,7 @@ describe 'View error index page', :js, :use_clean_rails_memory_store_caching, :s
include_context
'sentry error tracking context feature'
include_context
'sentry error tracking context feature'
let_it_be
(
:issues_response_body
)
{
fixture_file
(
'sentry/issues_sample_response.json'
)
}
let_it_be
(
:issues_response_body
)
{
fixture_file
(
'sentry/issues_sample_response.json'
)
}
let_it_be
(
:issues_response
)
{
JSON
.
parse
(
issues_response_body
)
}
let_it_be
(
:issues_response
)
{
Gitlab
::
Json
.
parse
(
issues_response_body
)
}
let
(
:issues_api_url
)
{
"
#{
sentry_api_urls
.
issues_url
}
?limit=20&query=is:unresolved"
}
let
(
:issues_api_url
)
{
"
#{
sentry_api_urls
.
issues_url
}
?limit=20&query=is:unresolved"
}
before
do
before
do
...
...
spec/features/projects/import_export/export_file_spec.rb
View file @
e47d2229
...
@@ -52,7 +52,7 @@ describe 'Import/Export - project export integration test', :js do
...
@@ -52,7 +52,7 @@ describe 'Import/Export - project export integration test', :js do
project_json_path
=
File
.
join
(
tmpdir
,
'project.json'
)
project_json_path
=
File
.
join
(
tmpdir
,
'project.json'
)
expect
(
File
).
to
exist
(
project_json_path
)
expect
(
File
).
to
exist
(
project_json_path
)
project_hash
=
JSON
.
parse
(
IO
.
read
(
project_json_path
))
project_hash
=
Gitlab
::
Json
.
parse
(
IO
.
read
(
project_json_path
))
sensitive_words
.
each
do
|
sensitive_word
|
sensitive_words
.
each
do
|
sensitive_word
|
found
=
find_sensitive_attributes
(
sensitive_word
,
project_hash
)
found
=
find_sensitive_attributes
(
sensitive_word
,
project_hash
)
...
@@ -78,7 +78,7 @@ describe 'Import/Export - project export integration test', :js do
...
@@ -78,7 +78,7 @@ describe 'Import/Export - project export integration test', :js do
expect
(
File
).
to
exist
(
project_json_path
)
expect
(
File
).
to
exist
(
project_json_path
)
relations
=
[]
relations
=
[]
relations
<<
JSON
.
parse
(
IO
.
read
(
project_json_path
))
relations
<<
Gitlab
::
Json
.
parse
(
IO
.
read
(
project_json_path
))
Dir
.
glob
(
File
.
join
(
tmpdir
,
'tree/project'
,
'*.ndjson'
))
do
|
rb_filename
|
Dir
.
glob
(
File
.
join
(
tmpdir
,
'tree/project'
,
'*.ndjson'
))
do
|
rb_filename
|
File
.
foreach
(
rb_filename
)
do
|
line
|
File
.
foreach
(
rb_filename
)
do
|
line
|
json
=
ActiveSupport
::
JSON
.
decode
(
line
)
json
=
ActiveSupport
::
JSON
.
decode
(
line
)
...
...
spec/features/projects/settings/operations_settings_spec.rb
View file @
e47d2229
...
@@ -76,7 +76,7 @@ describe 'Projects > Settings > For a forked project', :js do
...
@@ -76,7 +76,7 @@ describe 'Projects > Settings > For a forked project', :js do
context
'success path'
do
context
'success path'
do
let
(
:projects_sample_response
)
do
let
(
:projects_sample_response
)
do
Gitlab
::
Utils
.
deep_indifferent_access
(
Gitlab
::
Utils
.
deep_indifferent_access
(
JSON
.
parse
(
fixture_file
(
'sentry/list_projects_sample_response.json'
))
Gitlab
::
Json
.
parse
(
fixture_file
(
'sentry/list_projects_sample_response.json'
))
)
)
end
end
...
...
spec/helpers/todos_helper_spec.rb
View file @
e47d2229
...
@@ -32,7 +32,7 @@ describe TodosHelper do
...
@@ -32,7 +32,7 @@ describe TodosHelper do
{
'id'
=>
projects
.
first
.
id
,
'text'
=>
projects
.
first
.
full_name
}
{
'id'
=>
projects
.
first
.
id
,
'text'
=>
projects
.
first
.
full_name
}
]
]
expect
(
JSON
.
parse
(
helper
.
todo_projects_options
)).
to
match_array
(
expected_results
)
expect
(
Gitlab
::
Json
.
parse
(
helper
.
todo_projects_options
)).
to
match_array
(
expected_results
)
end
end
end
end
end
end
spec/initializers/lograge_spec.rb
View file @
e47d2229
...
@@ -123,7 +123,7 @@ describe 'lograge', type: :request do
...
@@ -123,7 +123,7 @@ describe 'lograge', type: :request do
let
(
:logger
)
do
let
(
:logger
)
do
Logger
.
new
(
log_output
).
tap
{
|
logger
|
logger
.
formatter
=
->
(
_
,
_
,
_
,
msg
)
{
msg
}
}
Logger
.
new
(
log_output
).
tap
{
|
logger
|
logger
.
formatter
=
->
(
_
,
_
,
_
,
msg
)
{
msg
}
}
end
end
let
(
:log_data
)
{
JSON
.
parse
(
log_output
.
string
)
}
let
(
:log_data
)
{
Gitlab
::
Json
.
parse
(
log_output
.
string
)
}
before
do
before
do
Lograge
.
logger
=
logger
Lograge
.
logger
=
logger
...
...
spec/models/ci/pipeline_spec.rb
View file @
e47d2229
...
@@ -2351,7 +2351,7 @@ describe Ci::Pipeline, :mailer do
...
@@ -2351,7 +2351,7 @@ describe Ci::Pipeline, :mailer do
def
have_requested_pipeline_hook
(
status
)
def
have_requested_pipeline_hook
(
status
)
have_requested
(
:post
,
stubbed_hostname
(
hook
.
url
)).
with
do
|
req
|
have_requested
(
:post
,
stubbed_hostname
(
hook
.
url
)).
with
do
|
req
|
json_body
=
JSON
.
parse
(
req
.
body
)
json_body
=
Gitlab
::
Json
.
parse
(
req
.
body
)
json_body
[
'object_attributes'
][
'status'
]
==
status
&&
json_body
[
'object_attributes'
][
'status'
]
==
status
&&
json_body
[
'builds'
].
length
==
2
json_body
[
'builds'
].
length
==
2
end
end
...
...
spec/models/container_repository_spec.rb
View file @
e47d2229
...
@@ -19,7 +19,7 @@ describe ContainerRepository do
...
@@ -19,7 +19,7 @@ describe ContainerRepository do
.
with
(
headers:
{
'Accept'
=>
ContainerRegistry
::
Client
::
ACCEPTED_TYPES
.
join
(
', '
)
})
.
with
(
headers:
{
'Accept'
=>
ContainerRegistry
::
Client
::
ACCEPTED_TYPES
.
join
(
', '
)
})
.
to_return
(
.
to_return
(
status:
200
,
status:
200
,
body:
JSON
.
dump
(
tags:
[
'test_tag'
]),
body:
Gitlab
::
Json
.
dump
(
tags:
[
'test_tag'
]),
headers:
{
'Content-Type'
=>
'application/json'
})
headers:
{
'Content-Type'
=>
'application/json'
})
end
end
...
...
spec/models/project_services/irker_service_spec.rb
View file @
e47d2229
...
@@ -65,7 +65,7 @@ describe IrkerService do
...
@@ -65,7 +65,7 @@ describe IrkerService do
conn
=
@irker_server
.
accept
conn
=
@irker_server
.
accept
conn
.
each_line
do
|
line
|
conn
.
each_line
do
|
line
|
msg
=
JSON
.
parse
(
line
.
chomp
(
"
\n
"
))
msg
=
Gitlab
::
Json
.
parse
(
line
.
chomp
(
"
\n
"
))
expect
(
msg
.
keys
).
to
match_array
(
%w(to privmsg)
)
expect
(
msg
.
keys
).
to
match_array
(
%w(to privmsg)
)
expect
(
msg
[
'to'
]).
to
match_array
([
"irc://chat.freenode.net/#commits"
,
expect
(
msg
[
'to'
]).
to
match_array
([
"irc://chat.freenode.net/#commits"
,
"irc://test.net/#test"
])
"irc://test.net/#test"
])
...
...
spec/models/snippet_spec.rb
View file @
e47d2229
...
@@ -529,11 +529,11 @@ describe Snippet do
...
@@ -529,11 +529,11 @@ describe Snippet do
let
(
:snippet
)
{
build
(
:snippet
)
}
let
(
:snippet
)
{
build
(
:snippet
)
}
it
'excludes secret_token from generated json'
do
it
'excludes secret_token from generated json'
do
expect
(
JSON
.
parse
(
to_json
).
keys
).
not_to
include
(
"secret_token"
)
expect
(
Gitlab
::
Json
.
parse
(
to_json
).
keys
).
not_to
include
(
"secret_token"
)
end
end
it
'does not override existing exclude option value'
do
it
'does not override existing exclude option value'
do
expect
(
JSON
.
parse
(
to_json
(
except:
[
:id
])).
keys
).
not_to
include
(
"secret_token"
,
"id"
)
expect
(
Gitlab
::
Json
.
parse
(
to_json
(
except:
[
:id
])).
keys
).
not_to
include
(
"secret_token"
,
"id"
)
end
end
def
to_json
(
params
=
{})
def
to_json
(
params
=
{})
...
...
spec/requests/api/graphql/boards/board_lists_query_spec.rb
View file @
e47d2229
...
@@ -132,6 +132,6 @@ describe 'get board lists' do
...
@@ -132,6 +132,6 @@ describe 'get board lists' do
end
end
def
grab_list_data
(
response_body
)
def
grab_list_data
(
response_body
)
JSON
.
parse
(
response_body
)[
'data'
][
board_parent_type
][
'boards'
][
'edges'
][
0
][
'node'
][
'lists'
][
'edges'
]
Gitlab
::
Json
.
parse
(
response_body
)[
'data'
][
board_parent_type
][
'boards'
][
'edges'
][
0
][
'node'
][
'lists'
][
'edges'
]
end
end
end
end
spec/requests/api/graphql/project/issues_spec.rb
View file @
e47d2229
...
@@ -171,7 +171,7 @@ describe 'getting an issue list for a project' do
...
@@ -171,7 +171,7 @@ describe 'getting an issue list for a project' do
cursored_query
=
query
(
"sort: DUE_DATE_ASC, after:
\"
#{
end_cursor
}
\"
"
)
cursored_query
=
query
(
"sort: DUE_DATE_ASC, after:
\"
#{
end_cursor
}
\"
"
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
response_data
=
JSON
.
parse
(
response
.
body
)[
'data'
][
'project'
][
'issues'
][
'edges'
]
response_data
=
Gitlab
::
Json
.
parse
(
response
.
body
)[
'data'
][
'project'
][
'issues'
][
'edges'
]
expect
(
grab_iids
(
response_data
)).
to
eq
([
due_issue1
.
iid
,
due_issue4
.
iid
,
due_issue2
.
iid
])
expect
(
grab_iids
(
response_data
)).
to
eq
([
due_issue1
.
iid
,
due_issue4
.
iid
,
due_issue2
.
iid
])
end
end
...
@@ -193,7 +193,7 @@ describe 'getting an issue list for a project' do
...
@@ -193,7 +193,7 @@ describe 'getting an issue list for a project' do
cursored_query
=
query
(
"sort: DUE_DATE_DESC, after:
\"
#{
end_cursor
}
\"
"
)
cursored_query
=
query
(
"sort: DUE_DATE_DESC, after:
\"
#{
end_cursor
}
\"
"
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
response_data
=
JSON
.
parse
(
response
.
body
)[
'data'
][
'project'
][
'issues'
][
'edges'
]
response_data
=
Gitlab
::
Json
.
parse
(
response
.
body
)[
'data'
][
'project'
][
'issues'
][
'edges'
]
expect
(
grab_iids
(
response_data
)).
to
eq
([
due_issue3
.
iid
,
due_issue4
.
iid
,
due_issue2
.
iid
])
expect
(
grab_iids
(
response_data
)).
to
eq
([
due_issue3
.
iid
,
due_issue4
.
iid
,
due_issue2
.
iid
])
end
end
...
@@ -239,7 +239,7 @@ describe 'getting an issue list for a project' do
...
@@ -239,7 +239,7 @@ describe 'getting an issue list for a project' do
cursored_query
=
query
(
"sort: RELATIVE_POSITION_ASC, after:
\"
#{
end_cursor
}
\"
"
)
cursored_query
=
query
(
"sort: RELATIVE_POSITION_ASC, after:
\"
#{
end_cursor
}
\"
"
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
response_data
=
JSON
.
parse
(
response
.
body
)[
'data'
][
'project'
][
'issues'
][
'edges'
]
response_data
=
Gitlab
::
Json
.
parse
(
response
.
body
)[
'data'
][
'project'
][
'issues'
][
'edges'
]
expect
(
grab_iids
(
response_data
)).
to
eq
([
relative_issue1
.
iid
,
relative_issue4
.
iid
,
relative_issue2
.
iid
])
expect
(
grab_iids
(
response_data
)).
to
eq
([
relative_issue1
.
iid
,
relative_issue4
.
iid
,
relative_issue2
.
iid
])
end
end
...
@@ -288,7 +288,7 @@ describe 'getting an issue list for a project' do
...
@@ -288,7 +288,7 @@ describe 'getting an issue list for a project' do
cursored_query
=
query
(
"sort: PRIORITY_ASC, after:
\"
#{
end_cursor
}
\"
"
)
cursored_query
=
query
(
"sort: PRIORITY_ASC, after:
\"
#{
end_cursor
}
\"
"
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
response_data
=
JSON
.
parse
(
response
.
body
)[
'data'
][
'project'
][
'issues'
][
'edges'
]
response_data
=
Gitlab
::
Json
.
parse
(
response
.
body
)[
'data'
][
'project'
][
'issues'
][
'edges'
]
expect
(
grab_iids
(
response_data
)).
to
eq
([
priority_issue2
.
iid
,
priority_issue4
.
iid
])
expect
(
grab_iids
(
response_data
)).
to
eq
([
priority_issue2
.
iid
,
priority_issue4
.
iid
])
end
end
...
@@ -310,7 +310,7 @@ describe 'getting an issue list for a project' do
...
@@ -310,7 +310,7 @@ describe 'getting an issue list for a project' do
cursored_query
=
query
(
"sort: PRIORITY_DESC, after:
\"
#{
end_cursor
}
\"
"
)
cursored_query
=
query
(
"sort: PRIORITY_DESC, after:
\"
#{
end_cursor
}
\"
"
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
response_data
=
JSON
.
parse
(
response
.
body
)[
'data'
][
'project'
][
'issues'
][
'edges'
]
response_data
=
Gitlab
::
Json
.
parse
(
response
.
body
)[
'data'
][
'project'
][
'issues'
][
'edges'
]
expect
(
grab_iids
(
response_data
)).
to
eq
([
priority_issue2
.
iid
,
priority_issue4
.
iid
])
expect
(
grab_iids
(
response_data
)).
to
eq
([
priority_issue2
.
iid
,
priority_issue4
.
iid
])
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
e47d2229
...
@@ -24,7 +24,7 @@ shared_examples 'languages and percentages JSON response' do
...
@@ -24,7 +24,7 @@ shared_examples 'languages and percentages JSON response' do
get
api
(
"/projects/
#{
project
.
id
}
/languages"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/languages"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
JSON
.
parse
(
response
.
body
)).
to
eq
(
expected_languages
)
expect
(
Gitlab
::
Json
.
parse
(
response
.
body
)).
to
eq
(
expected_languages
)
end
end
end
end
...
@@ -672,7 +672,7 @@ describe API::Projects do
...
@@ -672,7 +672,7 @@ describe API::Projects do
match
[
1
]
match
[
1
]
end
end
ids
+=
JSON
.
parse
(
response
.
body
).
map
{
|
p
|
p
[
'id'
]
}
ids
+=
Gitlab
::
Json
.
parse
(
response
.
body
).
map
{
|
p
|
p
[
'id'
]
}
end
end
expect
(
ids
).
to
contain_exactly
(
*
projects
.
map
(
&
:id
))
expect
(
ids
).
to
contain_exactly
(
*
projects
.
map
(
&
:id
))
...
...
spec/services/metrics/dashboard/grafana_metric_embed_service_spec.rb
View file @
e47d2229
...
@@ -217,7 +217,7 @@ describe Metrics::Dashboard::DatasourceNameParser do
...
@@ -217,7 +217,7 @@ describe Metrics::Dashboard::DatasourceNameParser do
include
GrafanaApiHelpers
include
GrafanaApiHelpers
let
(
:grafana_url
)
{
valid_grafana_dashboard_link
(
'https://gitlab.grafana.net'
)
}
let
(
:grafana_url
)
{
valid_grafana_dashboard_link
(
'https://gitlab.grafana.net'
)
}
let
(
:grafana_dashboard
)
{
JSON
.
parse
(
fixture_file
(
'grafana/dashboard_response.json'
),
symbolize_names:
true
)
}
let
(
:grafana_dashboard
)
{
Gitlab
::
Json
.
parse
(
fixture_file
(
'grafana/dashboard_response.json'
),
symbolize_names:
true
)
}
subject
{
described_class
.
new
(
grafana_url
,
grafana_dashboard
).
parse
}
subject
{
described_class
.
new
(
grafana_url
,
grafana_dashboard
).
parse
}
...
...
spec/support/helpers/stub_gitlab_calls.rb
View file @
e47d2229
...
@@ -86,7 +86,7 @@ module StubGitlabCalls
...
@@ -86,7 +86,7 @@ module StubGitlabCalls
def
stub_container_registry_tag_manifest_content
def
stub_container_registry_tag_manifest_content
fixture_path
=
'spec/fixtures/container_registry/tag_manifest.json'
fixture_path
=
'spec/fixtures/container_registry/tag_manifest.json'
JSON
.
parse
(
File
.
read
(
Rails
.
root
+
fixture_path
))
Gitlab
::
Json
.
parse
(
File
.
read
(
Rails
.
root
+
fixture_path
))
end
end
def
stub_container_registry_blob_content
def
stub_container_registry_blob_content
...
@@ -113,12 +113,12 @@ module StubGitlabCalls
...
@@ -113,12 +113,12 @@ module StubGitlabCalls
def
stub_project_8
def
stub_project_8
data
=
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/project_8.json'
))
data
=
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/project_8.json'
))
allow_any_instance_of
(
Network
).
to
receive
(
:project
).
and_return
(
JSON
.
parse
(
data
))
allow_any_instance_of
(
Network
).
to
receive
(
:project
).
and_return
(
Gitlab
::
Json
.
parse
(
data
))
end
end
def
stub_project_8_hooks
def
stub_project_8_hooks
data
=
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/project_8_hooks.json'
))
data
=
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/project_8_hooks.json'
))
allow_any_instance_of
(
Network
).
to
receive
(
:project_hooks
).
and_return
(
JSON
.
parse
(
data
))
allow_any_instance_of
(
Network
).
to
receive
(
:project_hooks
).
and_return
(
Gitlab
::
Json
.
parse
(
data
))
end
end
def
stub_projects
def
stub_projects
...
@@ -143,7 +143,7 @@ module StubGitlabCalls
...
@@ -143,7 +143,7 @@ module StubGitlabCalls
def
project_hash_array
def
project_hash_array
f
=
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/projects.json'
))
f
=
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/projects.json'
))
JSON
.
parse
f
Gitlab
::
Json
.
parse
(
f
)
end
end
end
end
...
...
spec/support/helpers/workhorse_helpers.rb
View file @
e47d2229
...
@@ -11,7 +11,7 @@ module WorkhorseHelpers
...
@@ -11,7 +11,7 @@ module WorkhorseHelpers
header
=
split_header
.
join
(
':'
)
header
=
split_header
.
join
(
':'
)
[
[
type
,
type
,
JSON
.
parse
(
Base64
.
urlsafe_decode64
(
header
))
Gitlab
::
Json
.
parse
(
Base64
.
urlsafe_decode64
(
header
))
]
]
end
end
end
end
...
...
spec/support/import_export/configuration_helper.rb
View file @
e47d2229
...
@@ -44,8 +44,8 @@ module ConfigurationHelper
...
@@ -44,8 +44,8 @@ module ConfigurationHelper
import_export_config
=
config_hash
(
config
)
import_export_config
=
config_hash
(
config
)
excluded_attributes
=
import_export_config
[
:excluded_attributes
][
relation_name
.
to_sym
]
excluded_attributes
=
import_export_config
[
:excluded_attributes
][
relation_name
.
to_sym
]
included_attributes
=
import_export_config
[
:included_attributes
][
relation_name
.
to_sym
]
included_attributes
=
import_export_config
[
:included_attributes
][
relation_name
.
to_sym
]
attributes
=
attributes
-
JSON
.
parse
(
excluded_attributes
.
to_json
)
if
excluded_attributes
attributes
=
attributes
-
Gitlab
::
Json
.
parse
(
excluded_attributes
.
to_json
)
if
excluded_attributes
attributes
=
attributes
&
JSON
.
parse
(
included_attributes
.
to_json
)
if
included_attributes
attributes
=
attributes
&
Gitlab
::
Json
.
parse
(
included_attributes
.
to_json
)
if
included_attributes
attributes
attributes
end
end
...
...
spec/support/matchers/disallow_request_matchers.rb
View file @
e47d2229
...
@@ -11,7 +11,7 @@ end
...
@@ -11,7 +11,7 @@ end
RSpec
::
Matchers
.
define
:disallow_request_in_json
do
RSpec
::
Matchers
.
define
:disallow_request_in_json
do
match
do
|
response
|
match
do
|
response
|
json_response
=
JSON
.
parse
(
response
.
body
)
json_response
=
Gitlab
::
Json
.
parse
(
response
.
body
)
response
.
body
.
include?
(
'You cannot perform write operations'
)
&&
json_response
.
key?
(
'message'
)
response
.
body
.
include?
(
'You cannot perform write operations'
)
&&
json_response
.
key?
(
'message'
)
end
end
end
end
spec/support/shared_contexts/features/error_tracking_shared_context.rb
View file @
e47d2229
...
@@ -6,9 +6,9 @@ shared_context 'sentry error tracking context feature' do
...
@@ -6,9 +6,9 @@ shared_context 'sentry error tracking context feature' do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project_error_tracking_settings
)
{
create
(
:project_error_tracking_setting
,
project:
project
)
}
let_it_be
(
:project_error_tracking_settings
)
{
create
(
:project_error_tracking_setting
,
project:
project
)
}
let_it_be
(
:issue_response_body
)
{
fixture_file
(
'sentry/issue_sample_response.json'
)
}
let_it_be
(
:issue_response_body
)
{
fixture_file
(
'sentry/issue_sample_response.json'
)
}
let_it_be
(
:issue_response
)
{
JSON
.
parse
(
issue_response_body
)
}
let_it_be
(
:issue_response
)
{
Gitlab
::
Json
.
parse
(
issue_response_body
)
}
let_it_be
(
:event_response_body
)
{
fixture_file
(
'sentry/issue_latest_event_sample_response.json'
)
}
let_it_be
(
:event_response_body
)
{
fixture_file
(
'sentry/issue_latest_event_sample_response.json'
)
}
let_it_be
(
:event_response
)
{
JSON
.
parse
(
event_response_body
)
}
let_it_be
(
:event_response
)
{
Gitlab
::
Json
.
parse
(
event_response_body
)
}
let
(
:sentry_api_urls
)
{
Sentry
::
ApiUrls
.
new
(
project_error_tracking_settings
.
api_url
)
}
let
(
:sentry_api_urls
)
{
Sentry
::
ApiUrls
.
new
(
project_error_tracking_settings
.
api_url
)
}
let
(
:issue_id
)
{
issue_response
[
'id'
]
}
let
(
:issue_id
)
{
issue_response
[
'id'
]
}
let
(
:issue_seen
)
{
1
.
year
.
ago
.
utc
}
let
(
:issue_seen
)
{
1
.
year
.
ago
.
utc
}
...
...
spec/support/shared_contexts/json_response_shared_context.rb
View file @
e47d2229
# frozen_string_literal: true
# frozen_string_literal: true
RSpec
.
shared_context
'JSON response'
do
RSpec
.
shared_context
'JSON response'
do
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
let
(
:json_response
)
{
Gitlab
::
Json
.
parse
(
response
.
body
)
}
end
end
spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb
View file @
e47d2229
...
@@ -82,7 +82,7 @@ RSpec.shared_examples 'sorted paginated query' do
...
@@ -82,7 +82,7 @@ RSpec.shared_examples 'sorted paginated query' do
cursored_query
=
pagination_query
(
"sort:
#{
sort_param
}
, after:
\"
#{
end_cursor
}
\"
"
,
page_info
)
cursored_query
=
pagination_query
(
"sort:
#{
sort_param
}
, after:
\"
#{
end_cursor
}
\"
"
,
page_info
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
response_data
=
graphql_dig_at
(
JSON
.
parse
(
response
.
body
),
:data
,
*
data_path
,
:edges
)
response_data
=
graphql_dig_at
(
Gitlab
::
Json
.
parse
(
response
.
body
),
:data
,
*
data_path
,
:edges
)
expect
(
pagination_results_data
(
response_data
)).
to
eq
expected_results
.
drop
(
first_param
)
expect
(
pagination_results_data
(
response_data
)).
to
eq
expected_results
.
drop
(
first_param
)
end
end
...
...
spec/support/shared_examples/requests/api/graphql/group_and_project_boards_query_shared_examples.rb
View file @
e47d2229
...
@@ -80,7 +80,7 @@ RSpec.shared_examples 'group and project boards query' do
...
@@ -80,7 +80,7 @@ RSpec.shared_examples 'group and project boards query' do
cursored_query
=
query
(
"after:
\"
#{
end_cursor
}
\"
"
)
cursored_query
=
query
(
"after:
\"
#{
end_cursor
}
\"
"
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
post_graphql
(
cursored_query
,
current_user:
current_user
)
response_data
=
JSON
.
parse
(
response
.
body
)[
'data'
][
board_parent_type
][
'boards'
][
'edges'
]
response_data
=
Gitlab
::
Json
.
parse
(
response
.
body
)[
'data'
][
board_parent_type
][
'boards'
][
'edges'
]
expect
(
grab_names
(
response_data
)).
to
eq
expected_boards
.
drop
(
2
).
first
(
2
).
map
(
&
:name
)
expect
(
grab_names
(
response_data
)).
to
eq
expected_boards
.
drop
(
2
).
first
(
2
).
map
(
&
:name
)
end
end
...
...
spec/support/shared_examples/services/metrics/dashboard_shared_examples.rb
View file @
e47d2229
...
@@ -23,7 +23,7 @@ RSpec.shared_examples 'valid dashboard service response for schema' do
...
@@ -23,7 +23,7 @@ RSpec.shared_examples 'valid dashboard service response for schema' do
end
end
RSpec
.
shared_examples
'valid dashboard service response'
do
RSpec
.
shared_examples
'valid dashboard service response'
do
let
(
:dashboard_schema
)
{
JSON
.
parse
(
fixture_file
(
'lib/gitlab/metrics/dashboard/schemas/dashboard.json'
))
}
let
(
:dashboard_schema
)
{
Gitlab
::
Json
.
parse
(
fixture_file
(
'lib/gitlab/metrics/dashboard/schemas/dashboard.json'
))
}
it_behaves_like
'valid dashboard service response for schema'
it_behaves_like
'valid dashboard service response for schema'
end
end
...
@@ -38,7 +38,7 @@ RSpec.shared_examples 'caches the unprocessed dashboard for subsequent calls' do
...
@@ -38,7 +38,7 @@ RSpec.shared_examples 'caches the unprocessed dashboard for subsequent calls' do
end
end
RSpec
.
shared_examples
'valid embedded dashboard service response'
do
RSpec
.
shared_examples
'valid embedded dashboard service response'
do
let
(
:dashboard_schema
)
{
JSON
.
parse
(
fixture_file
(
'lib/gitlab/metrics/dashboard/schemas/embedded_dashboard.json'
))
}
let
(
:dashboard_schema
)
{
Gitlab
::
Json
.
parse
(
fixture_file
(
'lib/gitlab/metrics/dashboard/schemas/embedded_dashboard.json'
))
}
it_behaves_like
'valid dashboard service response for schema'
it_behaves_like
'valid dashboard service response for schema'
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