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
2d1a8ead
Commit
2d1a8ead
authored
Nov 16, 2021
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ee/ directory detection for Danger roulette
parent
be656e39
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
1 deletion
+67
-1
spec/tooling/danger/project_helper_spec.rb
spec/tooling/danger/project_helper_spec.rb
+66
-0
tooling/danger/project_helper.rb
tooling/danger/project_helper.rb
+1
-1
No files found.
spec/tooling/danger/project_helper_spec.rb
View file @
2d1a8ead
...
...
@@ -7,8 +7,10 @@ require 'danger/plugins/helper'
require
'gitlab/dangerfiles/spec_helper'
require_relative
'../../../danger/plugins/project_helper'
require_relative
'../../../spec/support/helpers/stub_env'
RSpec
.
describe
Tooling
::
Danger
::
ProjectHelper
do
include
StubENV
include_context
"with dangerfile"
let
(
:fake_danger
)
{
DangerSpecHelper
.
fake_danger
.
include
(
described_class
)
}
...
...
@@ -288,6 +290,70 @@ RSpec.describe Tooling::Danger::ProjectHelper do
end
end
describe
'#ee?'
do
subject
{
project_helper
.
__send__
(
:ee?
)
}
let
(
:ee_dir
)
{
File
.
expand_path
(
'../../../ee'
,
__dir__
)
}
context
'when ENV["CI_PROJECT_NAME"] is set'
do
before
do
stub_env
(
'CI_PROJECT_NAME'
,
ci_project_name
)
end
context
'when ENV["CI_PROJECT_NAME"] is gitlab'
do
let
(
:ci_project_name
)
{
'gitlab'
}
it
'returns true'
do
is_expected
.
to
eq
(
true
)
end
end
context
'when ENV["CI_PROJECT_NAME"] is gitlab-ee'
do
let
(
:ci_project_name
)
{
'gitlab-ee'
}
it
'returns true'
do
is_expected
.
to
eq
(
true
)
end
end
context
'when ENV["CI_PROJECT_NAME"] is gitlab-foss'
do
let
(
:ci_project_name
)
{
'gitlab-foss'
}
it
'resolves to Dir.exist?'
do
expected
=
Dir
.
exist?
(
ee_dir
)
expect
(
Dir
).
to
receive
(
:exist?
).
with
(
ee_dir
).
and_call_original
is_expected
.
to
eq
(
expected
)
end
end
end
context
'when ENV["CI_PROJECT_NAME"] is absent'
do
before
do
stub_env
(
'CI_PROJECT_NAME'
,
nil
)
expect
(
Dir
).
to
receive
(
:exist?
).
with
(
ee_dir
).
and_return
(
has_ee_dir
)
end
context
'when ee/ directory exists'
do
let
(
:has_ee_dir
)
{
true
}
it
'returns true'
do
is_expected
.
to
eq
(
true
)
end
end
context
'when ee/ directory does not exist'
do
let
(
:has_ee_dir
)
{
false
}
it
'returns false'
do
is_expected
.
to
eq
(
false
)
end
end
end
end
describe
'#file_lines'
do
let
(
:filename
)
{
'spec/foo_spec.rb'
}
let
(
:file_spy
)
{
spy
}
...
...
tooling/danger/project_helper.rb
View file @
2d1a8ead
...
...
@@ -202,7 +202,7 @@ module Tooling
def
ee?
# Support former project name for `dev` and support local Danger run
%w[gitlab gitlab-ee]
.
include?
(
ENV
[
'CI_PROJECT_NAME'
])
||
Dir
.
exist?
(
File
.
expand_path
(
'../../
../
ee'
,
__dir__
))
%w[gitlab gitlab-ee]
.
include?
(
ENV
[
'CI_PROJECT_NAME'
])
||
Dir
.
exist?
(
File
.
expand_path
(
'../../ee'
,
__dir__
))
end
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