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
b35084f8
Commit
b35084f8
authored
Feb 14, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a few EE-specific fixtures path related issues
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
65f68427
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
68 additions
and
69 deletions
+68
-69
ee/spec/controllers/groups/epics_controller_spec.rb
ee/spec/controllers/groups/epics_controller_spec.rb
+1
-1
ee/spec/lib/gitlab/email/handler/ee/service_desk_handler_spec.rb
.../lib/gitlab/email/handler/ee/service_desk_handler_spec.rb
+2
-2
ee/spec/lib/gitlab/email/handler_spec.rb
ee/spec/lib/gitlab/email/handler_spec.rb
+52
-0
ee/spec/lib/system_check/geo/authorized_keys_check_spec.rb
ee/spec/lib/system_check/geo/authorized_keys_check_spec.rb
+2
-2
ee/spec/requests/api/v3/github_spec.rb
ee/spec/requests/api/v3/github_spec.rb
+3
-3
ee/spec/services/ci/register_job_service_spec.rb
ee/spec/services/ci/register_job_service_spec.rb
+4
-4
spec/lib/gitlab/email/handler_spec.rb
spec/lib/gitlab/email/handler_spec.rb
+0
-43
spec/support/fixture_helpers.rb
spec/support/fixture_helpers.rb
+4
-14
No files found.
ee/spec/controllers/groups/epics_controller_spec.rb
View file @
b35084f8
...
@@ -141,7 +141,7 @@ describe Groups::EpicsController do
...
@@ -141,7 +141,7 @@ describe Groups::EpicsController do
show_epic
(
:json
)
show_epic
(
:json
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'entities/epic'
)
expect
(
response
).
to
match_response_schema
(
'entities/epic'
,
dir:
'ee'
)
end
end
context
'with unauthorized user'
do
context
'with unauthorized user'
do
...
...
ee/spec/lib/gitlab/email/handler/ee/service_desk_handler_spec.rb
View file @
b35084f8
...
@@ -8,7 +8,7 @@ describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
...
@@ -8,7 +8,7 @@ describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
stub_config_setting
(
host:
'localhost'
)
stub_config_setting
(
host:
'localhost'
)
end
end
let
(
:email_raw
)
{
fixture_file
(
'emails/service_desk.eml'
)
}
let
(
:email_raw
)
{
fixture_file
(
'emails/service_desk.eml'
,
dir:
'ee'
)
}
let
(
:namespace
)
{
create
(
:namespace
,
name:
"email"
)
}
let
(
:namespace
)
{
create
(
:namespace
,
name:
"email"
)
}
context
'service desk is enabled for the project'
do
context
'service desk is enabled for the project'
do
...
@@ -64,7 +64,7 @@ describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
...
@@ -64,7 +64,7 @@ describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
end
end
context
'when the email is forwarded through an alias'
do
context
'when the email is forwarded through an alias'
do
let
(
:email_raw
)
{
fixture_file
(
'emails/service_desk_forwarded.eml'
)
}
let
(
:email_raw
)
{
fixture_file
(
'emails/service_desk_forwarded.eml'
,
dir:
'ee'
)
}
it
'sends thank you the email and creates issue'
do
it
'sends thank you the email and creates issue'
do
setup_attachment
setup_attachment
...
...
ee/spec/lib/gitlab/email/handler_spec.rb
0 → 100644
View file @
b35084f8
require
'spec_helper'
describe
Gitlab
::
Email
::
Handler
do
before
do
stub_incoming_email_setting
(
enabled:
true
,
address:
"incoming+%{key}@appmail.adventuretime.ooo"
)
stub_config_setting
(
host:
'localhost'
)
end
describe
'.for'
do
def
handler_for
(
fixture
,
mail_key
)
described_class
.
for
(
fixture_file
(
fixture
),
mail_key
)
end
def
ee_handler_for
(
fixture
,
mail_key
)
described_class
.
for
(
fixture_file
(
fixture
,
dir:
'ee'
),
mail_key
)
end
context
'a Service Desk email'
do
it
'uses the Service Desk handler when Service Desk is enabled'
do
allow
(
License
).
to
receive
(
:feature_available?
).
and_call_original
allow
(
License
).
to
receive
(
:feature_available?
).
with
(
:service_desk
).
and_return
(
true
)
expect
(
ee_handler_for
(
'emails/service_desk.eml'
,
'some/project'
)).
to
be_instance_of
(
Gitlab
::
Email
::
Handler
::
EE
::
ServiceDeskHandler
)
end
it
'uses no handler when Service Desk is disabled'
do
allow
(
License
).
to
receive
(
:feature_available?
).
and_call_original
allow
(
License
).
to
receive
(
:feature_available?
).
with
(
:service_desk
).
and_return
(
false
)
expect
(
ee_handler_for
(
'emails/service_desk.eml'
,
'some/project'
)).
to
be_nil
end
end
context
'a new issue email'
do
let!
(
:user
)
{
create
(
:user
,
email:
'jake@adventuretime.ooo'
,
incoming_email_token:
'auth_token'
)
}
it
'uses the create issue handler when Service Desk is enabled'
do
allow
(
License
).
to
receive
(
:feature_available?
).
and_call_original
allow
(
License
).
to
receive
(
:feature_available?
).
with
(
:service_desk
).
and_return
(
true
)
expect
(
handler_for
(
'emails/valid_new_issue.eml'
,
'some/project+auth_token'
)).
to
be_instance_of
(
Gitlab
::
Email
::
Handler
::
CreateIssueHandler
)
end
it
'uses the create issue handler when Service Desk is disabled'
do
allow
(
License
).
to
receive
(
:feature_available?
).
and_call_original
allow
(
License
).
to
receive
(
:feature_available?
).
with
(
:service_desk
).
and_return
(
false
)
expect
(
handler_for
(
'emails/valid_new_issue.eml'
,
'some/project+auth_token'
)).
to
be_instance_of
(
Gitlab
::
Email
::
Handler
::
CreateIssueHandler
)
end
end
end
end
ee/spec/lib/system_check/geo/authorized_keys_check_spec.rb
View file @
b35084f8
...
@@ -33,7 +33,7 @@ describe SystemCheck::Geo::AuthorizedKeysCheck do
...
@@ -33,7 +33,7 @@ describe SystemCheck::Geo::AuthorizedKeysCheck do
it
'skips when config file is not readable'
do
it
'skips when config file is not readable'
do
override_sshd_config
(
'system_check/sshd_config'
)
override_sshd_config
(
'system_check/sshd_config'
)
allow
(
File
).
to
receive
(
:readable?
).
with
(
expand_fixture_
ee_path
(
'system_check/sshd_config
'
))
{
false
}
allow
(
File
).
to
receive
(
:readable?
).
with
(
expand_fixture_
path
(
'system_check/sshd_config'
,
dir:
'ee
'
))
{
false
}
expect_skipped
(
'Cannot access OpenSSH configuration file'
)
expect_skipped
(
'Cannot access OpenSSH configuration file'
)
...
@@ -167,6 +167,6 @@ describe SystemCheck::Geo::AuthorizedKeysCheck do
...
@@ -167,6 +167,6 @@ describe SystemCheck::Geo::AuthorizedKeysCheck do
end
end
def
override_sshd_config
(
relative_path
)
def
override_sshd_config
(
relative_path
)
allow
(
subject
).
to
receive
(
:openssh_config_path
)
{
expand_fixture_
ee_path
(
relative_path
)
}
allow
(
subject
).
to
receive
(
:openssh_config_path
)
{
expand_fixture_
path
(
relative_path
,
dir:
'ee'
)
}
end
end
end
end
ee/spec/requests/api/v3/github_spec.rb
View file @
b35084f8
...
@@ -56,7 +56,7 @@ describe API::V3::Github do
...
@@ -56,7 +56,7 @@ describe API::V3::Github do
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
.
size
).
to
eq
(
2
)
expect
(
json_response
.
size
).
to
eq
(
2
)
expect
(
response
).
to
match_response_schema
(
'entities/github/repositories'
)
expect
(
response
).
to
match_response_schema
(
'entities/github/repositories'
,
dir:
'ee'
)
end
end
it
'returns valid project path as name'
do
it
'returns valid project path as name'
do
...
@@ -104,7 +104,7 @@ describe API::V3::Github do
...
@@ -104,7 +104,7 @@ describe API::V3::Github do
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
json_response
).
to
be_an
(
Array
)
expect
(
response
).
to
match_response_schema
(
'entities/github/branches'
)
expect
(
response
).
to
match_response_schema
(
'entities/github/branches'
,
dir:
'ee'
)
end
end
end
end
...
@@ -142,7 +142,7 @@ describe API::V3::Github do
...
@@ -142,7 +142,7 @@ describe API::V3::Github do
get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
user
)
get
v3_api
(
"/repos/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
commit_id
}
"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'entities/github/commit'
)
expect
(
response
).
to
match_response_schema
(
'entities/github/commit'
,
dir:
'ee'
)
end
end
end
end
...
...
ee/spec/services/ci/register_job_service_spec.rb
View file @
b35084f8
...
@@ -16,7 +16,7 @@ describe Ci::RegisterJobService do
...
@@ -16,7 +16,7 @@ describe Ci::RegisterJobService do
context
'allow to pick builds'
do
context
'allow to pick builds'
do
let
(
:build
)
{
execute
(
shared_runner
)
}
let
(
:build
)
{
execute
(
shared_runner
)
}
it
{
expect
(
build
).
to
be_kind_of
(
Build
)
}
it
{
expect
(
build
).
to
be_kind_of
(
Ci
::
Build
)
}
end
end
context
'when over the global quota'
do
context
'when over the global quota'
do
...
@@ -37,7 +37,7 @@ describe Ci::RegisterJobService do
...
@@ -37,7 +37,7 @@ describe Ci::RegisterJobService do
end
end
it
"does return the build"
do
it
"does return the build"
do
expect
(
build
).
to
be_kind_of
(
Build
)
expect
(
build
).
to
be_kind_of
(
Ci
::
Build
)
end
end
end
end
...
@@ -47,7 +47,7 @@ describe Ci::RegisterJobService do
...
@@ -47,7 +47,7 @@ describe Ci::RegisterJobService do
end
end
it
"does return the build"
do
it
"does return the build"
do
expect
(
build
).
to
be_kind_of
(
Build
)
expect
(
build
).
to
be_kind_of
(
Ci
::
Build
)
end
end
end
end
...
@@ -57,7 +57,7 @@ describe Ci::RegisterJobService do
...
@@ -57,7 +57,7 @@ describe Ci::RegisterJobService do
end
end
it
"does return the build"
do
it
"does return the build"
do
expect
(
build
).
to
be_kind_of
(
Build
)
expect
(
build
).
to
be_kind_of
(
Ci
::
Build
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/email/handler_spec.rb
View file @
b35084f8
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Email
::
Handler
do
describe
Gitlab
::
Email
::
Handler
do
before
do
stub_incoming_email_setting
(
enabled:
true
,
address:
"incoming+%{key}@appmail.adventuretime.ooo"
)
stub_config_setting
(
host:
'localhost'
)
end
describe
'.for'
do
describe
'.for'
do
it
'picks issue handler if there is not merge request prefix'
do
it
'picks issue handler if there is not merge request prefix'
do
expect
(
described_class
.
for
(
'email'
,
'project+key'
)).
to
be_an_instance_of
(
Gitlab
::
Email
::
Handler
::
CreateIssueHandler
)
expect
(
described_class
.
for
(
'email'
,
'project+key'
)).
to
be_an_instance_of
(
Gitlab
::
Email
::
Handler
::
CreateIssueHandler
)
...
@@ -18,43 +13,5 @@ describe Gitlab::Email::Handler do
...
@@ -18,43 +13,5 @@ describe Gitlab::Email::Handler do
it
'returns nil if no handler is found'
do
it
'returns nil if no handler is found'
do
expect
(
described_class
.
for
(
'email'
,
''
)).
to
be_nil
expect
(
described_class
.
for
(
'email'
,
''
)).
to
be_nil
end
end
def
handler_for
(
fixture
,
mail_key
)
described_class
.
for
(
fixture_file
(
fixture
),
mail_key
)
end
context
'a Service Desk email'
do
it
'uses the Service Desk handler when Service Desk is enabled'
do
allow
(
License
).
to
receive
(
:feature_available?
).
and_call_original
allow
(
License
).
to
receive
(
:feature_available?
).
with
(
:service_desk
).
and_return
(
true
)
expect
(
handler_for
(
'emails/service_desk.eml'
,
'some/project'
)).
to
be_instance_of
(
Gitlab
::
Email
::
Handler
::
EE
::
ServiceDeskHandler
)
end
it
'uses no handler when Service Desk is disabled'
do
allow
(
License
).
to
receive
(
:feature_available?
).
and_call_original
allow
(
License
).
to
receive
(
:feature_available?
).
with
(
:service_desk
).
and_return
(
false
)
expect
(
handler_for
(
'emails/service_desk.eml'
,
'some/project'
)).
to
be_nil
end
end
context
'a new issue email'
do
let!
(
:user
)
{
create
(
:user
,
email:
'jake@adventuretime.ooo'
,
incoming_email_token:
'auth_token'
)
}
it
'uses the create issue handler when Service Desk is enabled'
do
allow
(
License
).
to
receive
(
:feature_available?
).
and_call_original
allow
(
License
).
to
receive
(
:feature_available?
).
with
(
:service_desk
).
and_return
(
true
)
expect
(
handler_for
(
'emails/valid_new_issue.eml'
,
'some/project+auth_token'
)).
to
be_instance_of
(
Gitlab
::
Email
::
Handler
::
CreateIssueHandler
)
end
it
'uses the create issue handler when Service Desk is disabled'
do
allow
(
License
).
to
receive
(
:feature_available?
).
and_call_original
allow
(
License
).
to
receive
(
:feature_available?
).
with
(
:service_desk
).
and_return
(
false
)
expect
(
handler_for
(
'emails/valid_new_issue.eml'
,
'some/project+auth_token'
)).
to
be_instance_of
(
Gitlab
::
Email
::
Handler
::
CreateIssueHandler
)
end
end
end
end
end
end
spec/support/fixture_helpers.rb
View file @
b35084f8
module
FixtureHelpers
module
FixtureHelpers
def
fixture_file
(
filename
)
def
fixture_file
(
filename
,
dir:
''
)
return
''
if
filename
.
blank?
return
''
if
filename
.
blank?
File
.
read
(
expand_fixture_path
(
filename
))
File
.
read
(
expand_fixture_path
(
filename
,
dir:
dir
))
end
end
def
fixture_file_ee
(
filename
)
def
expand_fixture_path
(
filename
,
dir:
''
)
return
''
if
filename
.
blank?
File
.
expand_path
(
Rails
.
root
.
join
(
dir
,
'spec'
,
'fixtures'
,
filename
))
File
.
read
(
expand_fixture_ee_path
(
filename
))
end
def
expand_fixture_path
(
filename
)
File
.
expand_path
(
Rails
.
root
.
join
(
'spec/fixtures/'
,
filename
))
end
def
expand_fixture_ee_path
(
filename
)
File
.
expand_path
(
Rails
.
root
.
join
(
'ee/spec/fixtures/'
,
filename
))
end
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