Commit 9436a444 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Rename reply_key to mail_key

parent 4b341dea
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment