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
Boxiang Sun
gitlab-ce
Commits
9436a444
Commit
9436a444
authored
May 20, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename reply_key to mail_key
parent
4b341dea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
spec/fixtures/emails/wrong_mail_key.eml
spec/fixtures/emails/wrong_mail_key.eml
+0
-0
spec/lib/gitlab/email/receiver_spec.rb
spec/lib/gitlab/email/receiver_spec.rb
+11
-11
No files found.
spec/fixtures/emails/wrong_
reply
_key.eml
→
spec/fixtures/emails/wrong_
mail
_key.eml
View file @
9436a444
File moved
spec/lib/gitlab/email/receiver_spec.rb
View file @
9436a444
...
@@ -6,13 +6,13 @@ describe Gitlab::Email::Receiver, lib: true do
...
@@ -6,13 +6,13 @@ describe Gitlab::Email::Receiver, lib: true do
stub_config_setting
(
host:
'localhost'
)
stub_config_setting
(
host:
'localhost'
)
end
end
let
(
:
reply_key
)
{
"59d8df8370b7e95c5a49fbf86aeb2c93"
}
let
(
:
mail_key
)
{
"59d8df8370b7e95c5a49fbf86aeb2c93"
}
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_reply.eml'
)
}
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_reply.eml'
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:noteable
)
{
create
(
:issue
,
project:
project
)
}
let
(
:noteable
)
{
create
(
:issue
,
project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:sent_notification
)
{
SentNotification
.
record
(
noteable
,
user
.
id
,
reply
_key
)
}
let!
(
:sent_notification
)
{
SentNotification
.
record
(
noteable
,
user
.
id
,
mail
_key
)
}
let
(
:receiver
)
{
described_class
.
new
(
email_raw
)
}
let
(
:receiver
)
{
described_class
.
new
(
email_raw
)
}
let
(
:markdown
)
{
"![image](uploads/image.png)"
}
let
(
:markdown
)
{
"![image](uploads/image.png)"
}
...
@@ -30,16 +30,16 @@ describe Gitlab::Email::Receiver, lib: true do
...
@@ -30,16 +30,16 @@ describe Gitlab::Email::Receiver, lib: true do
)
)
end
end
context
"when the recipient address doesn't include a
reply
key"
do
context
"when the recipient address doesn't include a
mail
key"
do
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_reply.eml'
).
gsub
(
reply
_key
,
""
)
}
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_reply.eml'
).
gsub
(
mail
_key
,
""
)
}
it
"raises a SentNotificationNotFoundError"
do
it
"raises a SentNotificationNotFoundError"
do
expect
{
receiver
.
execute
}.
to
raise_error
(
Gitlab
::
Email
::
SentNotificationNotFoundError
)
expect
{
receiver
.
execute
}.
to
raise_error
(
Gitlab
::
Email
::
SentNotificationNotFoundError
)
end
end
end
end
context
"when no sent notification for the
reply
key could be found"
do
context
"when no sent notification for the
mail
key could be found"
do
let
(
:email_raw
)
{
fixture_file
(
'emails/wrong_
reply
_key.eml'
)
}
let
(
:email_raw
)
{
fixture_file
(
'emails/wrong_
mail
_key.eml'
)
}
it
"raises a SentNotificationNotFoundError"
do
it
"raises a SentNotificationNotFoundError"
do
expect
{
receiver
.
execute
}.
to
raise_error
(
Gitlab
::
Email
::
SentNotificationNotFoundError
)
expect
{
receiver
.
execute
}.
to
raise_error
(
Gitlab
::
Email
::
SentNotificationNotFoundError
)
...
@@ -55,7 +55,7 @@ describe Gitlab::Email::Receiver, lib: true do
...
@@ -55,7 +55,7 @@ describe Gitlab::Email::Receiver, lib: true do
end
end
context
"when the email was auto generated"
do
context
"when the email was auto generated"
do
let!
(
:
reply_key
)
{
'636ca428858779856c226bb145ef4fad'
}
let!
(
:
mail_key
)
{
'636ca428858779856c226bb145ef4fad'
}
let!
(
:email_raw
)
{
fixture_file
(
"emails/auto_reply.eml"
)
}
let!
(
:email_raw
)
{
fixture_file
(
"emails/auto_reply.eml"
)
}
it
"raises an AutoGeneratedEmailError"
do
it
"raises an AutoGeneratedEmailError"
do
...
@@ -147,8 +147,8 @@ describe Gitlab::Email::Receiver, lib: true do
...
@@ -147,8 +147,8 @@ describe Gitlab::Email::Receiver, lib: true do
stub_incoming_email_setting
(
enabled:
true
,
address:
nil
)
stub_incoming_email_setting
(
enabled:
true
,
address:
nil
)
end
end
shared_examples
'an email that contains a
reply
key'
do
|
header
|
shared_examples
'an email that contains a
mail
key'
do
|
header
|
it
"fetches the
reply
key from the
#{
header
}
header and creates a comment"
do
it
"fetches the
mail
key from the
#{
header
}
header and creates a comment"
do
expect
{
receiver
.
execute
}.
to
change
{
noteable
.
notes
.
count
}.
by
(
1
)
expect
{
receiver
.
execute
}.
to
change
{
noteable
.
notes
.
count
}.
by
(
1
)
note
=
noteable
.
notes
.
last
note
=
noteable
.
notes
.
last
...
@@ -157,10 +157,10 @@ describe Gitlab::Email::Receiver, lib: true do
...
@@ -157,10 +157,10 @@ describe Gitlab::Email::Receiver, lib: true do
end
end
end
end
context
'
reply
key is in the References header'
do
context
'
mail
key is in the References header'
do
let
(
:email_raw
)
{
fixture_file
(
'emails/reply_without_subaddressing_and_key_inside_references.eml'
)
}
let
(
:email_raw
)
{
fixture_file
(
'emails/reply_without_subaddressing_and_key_inside_references.eml'
)
}
it_behaves_like
'an email that contains a
reply
key'
,
'References'
it_behaves_like
'an email that contains a
mail
key'
,
'References'
end
end
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