Открыть боковую панель
nt_test121
nt_project_9da4a5yt9x4b
Коммиты
9f9c5031
Не подтверждена
Коммит
9f9c5031
создал
Сен 05, 2019
по автору
Francisco Javier López
Просмотр файлов
Stubbing ApplicationSetting.current in stub_application_setting
владелец
1c6aa98c
Изменения
9
Скрыть пробелы
Построчно
Рядом
spec/controllers/projects/issues_controller_spec.rb
Просмотр файла @
9f9c5031
...
...
@@ -1040,7 +1040,7 @@ def post_verified_issue
context
'properly submits to Akismet'
do
before
do
allow_any_instance_of
(
AkismetService
).
to
receive_messages
(
submit_spam:
true
)
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive_messages
(
akismet_enabled:
true
)
stub_a
pplication
_s
etting
(
akismet_enabled:
true
)
end
def
post_spam
...
...
spec/lib/gitlab/asciidoc_spec.rb
Просмотр файла @
9f9c5031
...
...
@@ -7,10 +7,6 @@ module Gitlab
describe
Asciidoc
do
include
FakeBlobHelpers
before
do
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:current
).
and_return
(
::
ApplicationSetting
.
create_from_defaults
)
end
context
"without project"
do
let
(
:input
)
{
'<b>ascii</b>'
}
let
(
:context
)
{
{}
}
...
...
spec/lib/gitlab/auth_spec.rb
Просмотр файла @
9f9c5031
...
...
@@ -290,7 +290,7 @@ def operation
end
it
'throws an error suggesting user create a PAT when internal auth is disabled'
do
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
password_authentication_enabled_for_git
?
)
{
false
}
stub_a
pplication
_s
etting
(
password_authentication_enabled_for_git
:
false
)
expect
{
gl_auth
.
find_for_git_client
(
'foo'
,
'bar'
,
project:
nil
,
ip:
'ip'
)
}.
to
raise_error
(
Gitlab
::
Auth
::
MissingPersonalAccessTokenError
)
end
...
...
spec/lib/gitlab/legacy_github_import/project_creator_spec.rb
Просмотр файла @
9f9c5031
...
...
@@ -69,8 +69,8 @@
context
'when visibility level is restricted'
do
context
'when GitHub project is private'
do
before
do
stub_application_setting
(
restricted_visibility_levels:
[
Gitlab
::
VisibilityLevel
::
PRIVATE
]
)
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:
default_project_visibility
).
and_return
(
Gitlab
::
VisibilityLevel
::
INTERNAL
)
stub_application_setting
(
restricted_visibility_levels:
[
Gitlab
::
VisibilityLevel
::
PRIVATE
]
,
default_project_visibility
:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
end
it
'sets project visibility to the default project visibility'
do
...
...
@@ -84,8 +84,8 @@
context
'when GitHub project is public'
do
before
do
stub_application_setting
(
restricted_visibility_levels:
[
Gitlab
::
VisibilityLevel
::
PUBLIC
]
)
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:
default_project_visibility
).
and_return
(
Gitlab
::
VisibilityLevel
::
INTERNAL
)
stub_application_setting
(
restricted_visibility_levels:
[
Gitlab
::
VisibilityLevel
::
PUBLIC
]
,
default_project_visibility
:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
end
it
'sets project visibility to the default project visibility'
do
...
...
spec/models/user_spec.rb
Просмотр файла @
9f9c5031
...
...
@@ -243,7 +243,7 @@
describe
'email'
do
context
'when no signup domains whitelisted'
do
before
do
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
domain_whitelist
).
and_return
(
[])
stub_a
pplication
_s
etting
(
domain_whitelist
:
[])
end
it
'accepts any email'
do
...
...
@@ -254,7 +254,7 @@
context
'when a signup domain is whitelisted and subdomains are allowed'
do
before
do
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
domain_whitelist
).
and_return
(
[
'example.com'
,
'*.example.com'
])
stub_a
pplication
_s
etting
(
domain_whitelist
:
[
'example.com'
,
'*.example.com'
])
end
it
'accepts info@example.com'
do
...
...
@@ -275,7 +275,7 @@
context
'when a signup domain is whitelisted and subdomains are not allowed'
do
before
do
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
domain_whitelist
).
and_return
(
[
'example.com'
])
stub_a
pplication
_s
etting
(
domain_whitelist
:
[
'example.com'
])
end
it
'accepts info@example.com'
do
...
...
@@ -301,8 +301,8 @@
context
'domain blacklist'
do
before
do
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
domain_blacklist_enabled
?
).
and_return
(
true
)
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
domain_blacklist
).
and_return
(
[
'example.com'
])
stub_a
pplication
_s
etting
(
domain_blacklist_enabled
:
true
)
stub_a
pplication
_s
etting
(
domain_blacklist
:
[
'example.com'
])
end
context
'when a signup domain is blacklisted'
do
...
...
@@ -324,8 +324,8 @@
context
'when a signup domain is blacklisted but a wildcard subdomain is allowed'
do
before
do
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
domain_blacklist
).
and_return
(
[
'test.example.com'
])
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
domain_whitelist
).
and_return
(
[
'*.example.com'
])
stub_a
pplication
_s
etting
(
domain_blacklist
:
[
'test.example.com'
])
stub_a
pplication
_s
etting
(
domain_whitelist
:
[
'*.example.com'
])
end
it
'gives priority to whitelist and allow info@test.example.com'
do
...
...
@@ -336,7 +336,7 @@
context
'with both lists containing a domain'
do
before
do
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
domain_whitelist
).
and_return
(
[
'test.com'
])
stub_a
pplication
_s
etting
(
domain_whitelist
:
[
'test.com'
])
end
it
'accepts info@test.com'
do
...
...
@@ -845,7 +845,7 @@
describe
'#confirm'
do
before
do
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
send_user_confirmation_email
).
and_return
(
true
)
stub_a
pplication
_s
etting
(
send_user_confirmation_email
:
true
)
end
let
(
:user
)
{
create
(
:user
,
confirmed_at:
nil
,
unconfirmed_email:
'test@gitlab.com'
)
}
...
...
spec/requests/git_http_spec.rb
Просмотр файла @
9f9c5031
...
...
@@ -612,7 +612,7 @@
context
'when internal auth is disabled'
do
before
do
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
password_authentication_enabled_for_git
?
)
{
false
}
stub_a
pplication
_s
etting
(
password_authentication_enabled_for_git
:
false
)
end
it
'rejects pulls with personal access token error message'
do
...
...
spec/requests/jwt_controller_spec.rb
Просмотр файла @
9f9c5031
...
...
@@ -132,7 +132,8 @@
context
'when internal auth is disabled'
do
it
'rejects the authorization attempt with personal access token message'
do
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:password_authentication_enabled_for_git?
)
{
false
}
stub_application_setting
(
password_authentication_enabled_for_git:
false
)
get
'/jwt/auth'
,
params:
parameters
,
headers:
headers
expect
(
response
).
to
have_gitlab_http_status
(
401
)
...
...
spec/services/groups/create_service_spec.rb
Просмотр файла @
9f9c5031
...
...
@@ -17,7 +17,7 @@
context
"cannot create group with restricted visibility level"
do
before
do
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
restricted_visibility_levels
).
and_return
(
[
Gitlab
::
VisibilityLevel
::
PUBLIC
])
stub_a
pplication
_s
etting
(
restricted_visibility_levels
:
[
Gitlab
::
VisibilityLevel
::
PUBLIC
])
end
it
{
is_expected
.
not_to
be_persisted
}
...
...
spec/support/helpers/stub_configuration.rb
Просмотр файла @
9f9c5031
...
...
@@ -11,9 +11,10 @@ module StubConfiguration
def
stub_application_setting
(
messages
)
add_predicates
(
messages
)
# Stubbing
both
of these because we're not yet consistent with how we access
# Stubbing
all
of these because we're not yet consistent with how we access
# current application settings
allow_any_instance_of
(
ApplicationSetting
).
to
receive_messages
(
to_settings
(
messages
))
allow
(
ApplicationSetting
).
to
receive
(
:current
).
and_return
(
ApplicationSetting
.
new
)
allow
(
Gitlab
::
CurrentSettings
.
current_application_settings
)
.
to
receive_messages
(
to_settings
(
messages
))
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать