BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
67ae8adc
Commit
67ae8adc
authored
Jul 09, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed MailRoom specs and make sure it works with new resque.yml format
Some codestyle changes
parent
6f318795
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
25 deletions
+28
-25
mail_room.rb
lib/gitlab/mail_room.rb
+4
-0
redis.rb
lib/gitlab/redis.rb
+5
-1
mail_room_spec.rb
spec/config/mail_room_spec.rb
+19
-24
No files found.
lib/gitlab/mail_room.rb
View file @
67ae8adc
...
...
@@ -14,6 +14,10 @@ module Gitlab
@config
||=
fetch_config
end
def
reload_config!
@config
=
fetch_config
end
private
def
fetch_config
...
...
lib/gitlab/redis.rb
View file @
67ae8adc
...
...
@@ -24,7 +24,7 @@ module Gitlab
# @deprecated Use .params instead to get sentinel support
def
url
raw_config_hash
[
:url
]
new
.
url
end
def
with
...
...
@@ -45,6 +45,10 @@ module Gitlab
redis_store_options
end
def
url
raw_config_hash
[
:url
]
end
private
def
redis_store_options
...
...
spec/config/mail_room_spec.rb
View file @
67ae8adc
require
"spec_helper"
require
'spec_helper'
describe
"mail_room.yml"
do
let
(
:config_path
)
{
"config/mail_room.yml"
}
describe
'mail_room.yml'
do
let
(
:config_path
)
{
'config/mail_room.yml'
}
let
(
:configuration
)
{
YAML
.
load
(
ERB
.
new
(
File
.
read
(
config_path
)).
result
)
}
context
"when incoming email is disabled"
do
context
'when incoming email is disabled'
do
before
do
ENV
[
"MAIL_ROOM_GITLAB_CONFIG_FILE"
]
=
Rails
.
root
.
join
(
"spec/fixtures/mail_room_disabled.yml"
).
to_s
ENV
[
'MAIL_ROOM_GITLAB_CONFIG_FILE'
]
=
Rails
.
root
.
join
(
'spec/fixtures/mail_room_disabled.yml'
).
to_s
Gitlab
::
MailRoom
.
reload_config!
end
after
do
ENV
[
"MAIL_ROOM_GITLAB_CONFIG_FILE"
]
=
nil
ENV
[
'MAIL_ROOM_GITLAB_CONFIG_FILE'
]
=
nil
end
it
"contains no configuration"
do
it
'contains no configuration'
do
expect
(
configuration
[
:mailboxes
]).
to
be_nil
end
end
context
"when incoming email is enabled"
do
context
'when incoming email is enabled'
do
before
do
ENV
[
"MAIL_ROOM_GITLAB_CONFIG_FILE"
]
=
Rails
.
root
.
join
(
"spec/fixtures/mail_room_enabled.yml"
).
to_s
ENV
[
'MAIL_ROOM_GITLAB_CONFIG_FILE'
]
=
Rails
.
root
.
join
(
'spec/fixtures/mail_room_enabled.yml'
).
to_s
Gitlab
::
MailRoom
.
reload_config!
end
after
do
ENV
[
"MAIL_ROOM_GITLAB_CONFIG_FILE"
]
=
nil
ENV
[
'MAIL_ROOM_GITLAB_CONFIG_FILE'
]
=
nil
end
it
"contains the intended configuration"
do
it
'contains the intended configuration'
do
expect
(
configuration
[
:mailboxes
].
length
).
to
eq
(
1
)
mailbox
=
configuration
[
:mailboxes
].
first
expect
(
mailbox
[
:host
]).
to
eq
(
"imap.gmail.com"
)
expect
(
mailbox
[
:host
]).
to
eq
(
'imap.gmail.com'
)
expect
(
mailbox
[
:port
]).
to
eq
(
993
)
expect
(
mailbox
[
:ssl
]).
to
eq
(
true
)
expect
(
mailbox
[
:start_tls
]).
to
eq
(
false
)
expect
(
mailbox
[
:email
]).
to
eq
(
"gitlab-incoming@gmail.com"
)
expect
(
mailbox
[
:password
]).
to
eq
(
"[REDACTED]"
)
expect
(
mailbox
[
:name
]).
to
eq
(
"inbox"
)
redis_config_file
=
Rails
.
root
.
join
(
'config'
,
'resque.yml'
)
redis_url
=
if
File
.
exist?
(
redis_config_file
)
YAML
.
load_file
(
redis_config_file
)[
Rails
.
env
]
else
"redis://localhost:6379"
end
expect
(
mailbox
[
:email
]).
to
eq
(
'gitlab-incoming@gmail.com'
)
expect
(
mailbox
[
:password
]).
to
eq
(
'[REDACTED]'
)
expect
(
mailbox
[
:name
]).
to
eq
(
'inbox'
)
redis_url
=
Gitlab
::
Redis
.
url
expect
(
mailbox
[
:delivery_options
][
:redis_url
]).
to
eq
(
redis_url
)
expect
(
mailbox
[
:arbitration_options
][
:redis_url
]).
to
eq
(
redis_url
)
...
...
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