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
a311bb75
Commit
a311bb75
authored
Feb 26, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce differences in spec/support/helpers/stub_configuration.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
5d79d8fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
ee/spec/support/helpers/ee/stub_configuration.rb
ee/spec/support/helpers/ee/stub_configuration.rb
+12
-0
spec/support/helpers/stub_configuration.rb
spec/support/helpers/stub_configuration.rb
+2
-14
No files found.
ee/spec/support/helpers/ee/stub_configuration.rb
View file @
a311bb75
# frozen_string_literal: true
module
EE
module
StubConfiguration
def
stub_ee_application_setting
(
messages
)
...
...
@@ -12,5 +14,15 @@ module EE
# Ensure that we don't use the Markdown cache when stubbing these values
allow_any_instance_of
(
EE
::
ApplicationSetting
).
to
receive
(
:cached_html_up_to_date?
).
and_return
(
false
)
end
def
stub_application_setting_on_object
(
object
,
messages
)
add_predicates
(
messages
)
allow
(
::
Gitlab
::
CurrentSettings
.
current_application_settings
)
.
to
receive_messages
(
messages
)
messages
.
each
do
|
setting
,
value
|
allow
(
object
).
to
receive_message_chain
(
:current_application_settings
,
setting
)
{
value
}
end
end
end
end
spec/support/helpers/stub_configuration.rb
View file @
a311bb75
...
...
@@ -4,11 +4,7 @@ require 'active_support/dependencies'
require_dependency
'gitlab'
require_dependency
Gitlab
.
root
.
join
(
'ee/spec/support/helpers/ee/stub_configuration'
)
module
StubConfiguration
prepend
EE
::
StubConfiguration
def
stub_application_setting
(
messages
)
add_predicates
(
messages
)
...
...
@@ -22,16 +18,6 @@ module StubConfiguration
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:cached_html_up_to_date?
).
and_return
(
false
)
end
def
stub_application_setting_on_object
(
object
,
messages
)
add_predicates
(
messages
)
allow
(
Gitlab
::
CurrentSettings
.
current_application_settings
)
.
to
receive_messages
(
messages
)
messages
.
each
do
|
setting
,
value
|
allow
(
object
).
to
receive_message_chain
(
:current_application_settings
,
setting
)
{
value
}
end
end
def
stub_not_protect_default_branch
stub_application_setting
(
default_branch_protection:
Gitlab
::
Access
::
PROTECTION_NONE
)
...
...
@@ -130,3 +116,5 @@ module StubConfiguration
end
end
end
StubConfiguration
.
prepend
(
EE
::
StubConfiguration
)
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