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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
48e25a01
Commit
48e25a01
authored
Aug 20, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stub_reply_by_email_setting helper.
parent
6110e175
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
spec/lib/gitlab/email/receiver_spec.rb
spec/lib/gitlab/email/receiver_spec.rb
+1
-2
spec/lib/gitlab/reply_by_email_spec.rb
spec/lib/gitlab/reply_by_email_spec.rb
+6
-6
spec/support/stub_configuration.rb
spec/support/stub_configuration.rb
+4
-0
No files found.
spec/lib/gitlab/email/receiver_spec.rb
View file @
48e25a01
...
@@ -2,8 +2,7 @@ require "spec_helper"
...
@@ -2,8 +2,7 @@ require "spec_helper"
describe
Gitlab
::
Email
::
Receiver
do
describe
Gitlab
::
Email
::
Receiver
do
before
do
before
do
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive
(
:enabled
).
and_return
(
true
)
stub_reply_by_email_setting
(
enabled:
true
,
address:
"reply+%{reply_key}@appmail.adventuretime.ooo"
)
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive
(
:address
).
and_return
(
"reply+%{reply_key}@appmail.adventuretime.ooo"
)
end
end
let
(
:reply_key
)
{
"59d8df8370b7e95c5a49fbf86aeb2c93"
}
let
(
:reply_key
)
{
"59d8df8370b7e95c5a49fbf86aeb2c93"
}
...
...
spec/lib/gitlab/reply_by_email_spec.rb
View file @
48e25a01
...
@@ -4,12 +4,12 @@ describe Gitlab::ReplyByEmail do
...
@@ -4,12 +4,12 @@ describe Gitlab::ReplyByEmail do
describe
"self.enabled?"
do
describe
"self.enabled?"
do
context
"when reply by email is enabled"
do
context
"when reply by email is enabled"
do
before
do
before
do
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive
(
:enabled
).
and_return
(
true
)
stub_reply_by_email_setting
(
enabled:
true
)
end
end
context
"when the address is valid"
do
context
"when the address is valid"
do
before
do
before
do
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive
(
:address
).
and_return
(
"replies+%{reply_key}@example.com"
)
stub_reply_by_email_setting
(
address:
"replies+%{reply_key}@example.com"
)
end
end
it
"returns true"
do
it
"returns true"
do
...
@@ -19,7 +19,7 @@ describe Gitlab::ReplyByEmail do
...
@@ -19,7 +19,7 @@ describe Gitlab::ReplyByEmail do
context
"when the address is invalid"
do
context
"when the address is invalid"
do
before
do
before
do
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive
(
:address
).
and_return
(
"replies@example.com"
)
stub_reply_by_email_setting
(
address:
"replies@example.com"
)
end
end
it
"returns false"
do
it
"returns false"
do
...
@@ -30,7 +30,7 @@ describe Gitlab::ReplyByEmail do
...
@@ -30,7 +30,7 @@ describe Gitlab::ReplyByEmail do
context
"when reply by email is disabled"
do
context
"when reply by email is disabled"
do
before
do
before
do
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive
(
:enabled
).
and_return
(
false
)
stub_reply_by_email_setting
(
enabled:
false
)
end
end
it
"returns false"
do
it
"returns false"
do
...
@@ -66,7 +66,7 @@ describe Gitlab::ReplyByEmail do
...
@@ -66,7 +66,7 @@ describe Gitlab::ReplyByEmail do
context
"self.reply_address"
do
context
"self.reply_address"
do
before
do
before
do
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive
(
:address
).
and_return
(
"replies+%{reply_key}@example.com"
)
stub_reply_by_email_setting
(
address:
"replies+%{reply_key}@example.com"
)
end
end
it
"returns the address with an interpolated reply key"
do
it
"returns the address with an interpolated reply key"
do
...
@@ -76,7 +76,7 @@ describe Gitlab::ReplyByEmail do
...
@@ -76,7 +76,7 @@ describe Gitlab::ReplyByEmail do
context
"self.reply_key_from_address"
do
context
"self.reply_key_from_address"
do
before
do
before
do
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive
(
:address
).
and_return
(
"replies+%{reply_key}@example.com"
)
stub_reply_by_email_setting
(
address:
"replies+%{reply_key}@example.com"
)
end
end
it
"returns reply key"
do
it
"returns reply key"
do
...
...
spec/support/stub_configuration.rb
View file @
48e25a01
...
@@ -17,6 +17,10 @@ module StubConfiguration
...
@@ -17,6 +17,10 @@ module StubConfiguration
allow
(
Gitlab
.
config
.
gravatar
).
to
receive_messages
(
messages
)
allow
(
Gitlab
.
config
.
gravatar
).
to
receive_messages
(
messages
)
end
end
def
stub_reply_by_email_setting
(
messages
)
allow
(
Gitlab
.
config
.
reply_by_email
).
to
receive_messages
(
messages
)
end
private
private
# Modifies stubbed messages to also stub possible predicate versions
# Modifies stubbed messages to also stub possible predicate versions
...
...
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