diff options
author | Brett Walker <bwalker@gitlab.com> | 2018-12-28 21:53:39 +0300 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2019-01-03 23:37:35 +0300 |
commit | a4f2de796411236bfda81b7fa281cfa8199c5acf (patch) | |
tree | d1af8211ccae7ea525ca01f06c4993d4710c2771 /spec/lib/gitlab/email | |
parent | 54eb6260e75690ec45802618a7e1b9807f0e7e08 (diff) |
Refactoring and review comments
including verifying the project_slug
Diffstat (limited to 'spec/lib/gitlab/email')
-rw-r--r-- | spec/lib/gitlab/email/handler/create_issue_handler_spec.rb | 5 | ||||
-rw-r--r-- | spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb | 5 | ||||
-rw-r--r-- | spec/lib/gitlab/email/handler_spec.rb | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb b/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb index 583e73751d7..48139c2f9dc 100644 --- a/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb @@ -27,9 +27,10 @@ describe Gitlab::Email::Handler::CreateIssueHandler do let(:mail) { Mail::Message.new(email_raw) } it "matches the new format" do - handler = described_class.new(mail, "h5bp-html5-boilerplate-#{project.project_id}-#{user.incoming_email_token}-issue") + handler = described_class.new(mail, "gitlabhq-gitlabhq-#{project.project_id}-#{user.incoming_email_token}-issue") - expect(handler.instance_variable_get(:@project_id).to_i).to eq project.project_id + expect(handler.instance_variable_get(:@project_id)).to eq project.project_id + expect(handler.instance_variable_get(:@project_slug)).to eq project.full_path_slug expect(handler.instance_variable_get(:@incoming_email_token)).to eq user.incoming_email_token expect(handler.can_handle?).to be_truthy end diff --git a/spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb b/spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb index 0cf15adc35c..2fa86b2b46f 100644 --- a/spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb @@ -31,9 +31,10 @@ describe Gitlab::Email::Handler::CreateMergeRequestHandler do let(:mail) { Mail::Message.new(email_raw) } it "matches the new format" do - handler = described_class.new(mail, "h5bp-html5-boilerplate-#{project.project_id}-#{user.incoming_email_token}-merge-request") + handler = described_class.new(mail, "gitlabhq-gitlabhq-#{project.project_id}-#{user.incoming_email_token}-merge-request") - expect(handler.instance_variable_get(:@project_id).to_i).to eq project.project_id + expect(handler.instance_variable_get(:@project_id)).to eq project.project_id + expect(handler.instance_variable_get(:@project_slug)).to eq project.full_path_slug expect(handler.instance_variable_get(:@incoming_email_token)).to eq user.incoming_email_token expect(handler.can_handle?).to be_truthy end diff --git a/spec/lib/gitlab/email/handler_spec.rb b/spec/lib/gitlab/email/handler_spec.rb index 97c5f693c53..d2920b08956 100644 --- a/spec/lib/gitlab/email/handler_spec.rb +++ b/spec/lib/gitlab/email/handler_spec.rb @@ -19,7 +19,7 @@ describe Gitlab::Email::Handler do describe 'regexps are set properly' do let(:addresses) do - %W(sent_notification_key#{Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX} sent_notification_key path-to-project-project_id-user_email_token-merge-request path-to-project-user_email_token-issue) + + %W(sent_notification_key#{Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX} sent_notification_key path-to-project-123-user_email_token-merge-request path-to-project-123-user_email_token-issue) + %W(sent_notification_key#{Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX_LEGACY} sent_notification_key path/to/project+merge-request+user_email_token path/to/project+user_email_token) end |