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
fa674fa5
Commit
fa674fa5
authored
Aug 28, 2019
by
Doug Stull
Committed by
Ash McKenzie
Aug 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename dev, org, com helper
parent
6308c0ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
lib/gitlab.rb
lib/gitlab.rb
+1
-1
spec/lib/gitlab_spec.rb
spec/lib/gitlab_spec.rb
+27
-0
No files found.
lib/gitlab.rb
View file @
fa674fa5
...
@@ -55,7 +55,7 @@ module Gitlab
...
@@ -55,7 +55,7 @@ module Gitlab
SUBDOMAIN_REGEX
===
Gitlab
.
config
.
gitlab
.
url
SUBDOMAIN_REGEX
===
Gitlab
.
config
.
gitlab
.
url
end
end
def
self
.
dev_env_or_com?
def
self
.
dev_env_or
g_or
_com?
Rails
.
env
.
development?
||
org?
||
com?
Rails
.
env
.
development?
||
org?
||
com?
end
end
...
...
spec/lib/gitlab_spec.rb
View file @
fa674fa5
...
@@ -98,6 +98,33 @@ describe Gitlab do
...
@@ -98,6 +98,33 @@ describe Gitlab do
end
end
end
end
describe
'.dev_env_org_or_com?'
do
it
'is true when on .com'
do
allow
(
described_class
).
to
receive_messages
(
com?:
true
,
org?:
false
)
expect
(
described_class
.
dev_env_org_or_com?
).
to
eq
true
end
it
'is true when org'
do
allow
(
described_class
).
to
receive_messages
(
com?:
false
,
org?:
true
)
expect
(
described_class
.
dev_env_org_or_com?
).
to
eq
true
end
it
'is true when dev env'
do
allow
(
described_class
).
to
receive_messages
(
com?:
false
,
org?:
false
)
allow
(
Rails
).
to
receive
(
:env
).
and_return
(
ActiveSupport
::
StringInquirer
.
new
(
'development'
))
expect
(
described_class
.
dev_env_org_or_com?
).
to
eq
true
end
it
'is false when not dev, org or com'
do
allow
(
described_class
).
to
receive_messages
(
com?:
false
,
org?:
false
)
expect
(
described_class
.
dev_env_org_or_com?
).
to
eq
false
end
end
describe
'.ee?'
do
describe
'.ee?'
do
before
do
before
do
described_class
.
instance_variable_set
(
:@is_ee
,
nil
)
described_class
.
instance_variable_set
(
:@is_ee
,
nil
)
...
...
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