diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-06-24 16:05:05 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-06-24 16:05:05 +0800 |
commit | e616fbfd425f838ca83fe01c3adf10e6b8e5a934 (patch) | |
tree | 3e5a023a47a967caf96ef553d4b04ebe92bd2257 /spec | |
parent | 918646f8e9daa954d25f122f866bd675c1278c42 (diff) | |
download | gitlab-ce-e616fbfd425f838ca83fe01c3adf10e6b8e5a934.tar.gz |
Only return the address if incoming emails is enabled:
Feedback from:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3363#note_12669123
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/project_spec.rb | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 407efc9f966..5d41bc2d38c 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -130,18 +130,30 @@ describe Project, models: true do end describe "#new_issue_address" do - before do - stub_incoming_email_setting(address: "p+%{key}@gl.ab") - end - let(:project) { create(:empty_project, path: "somewhere") } let(:user) { create(:user) } - it 'returns the address to create a new issue' do - token = user.authentication_token - address = "p+#{project.namespace.path}/#{project.path}+#{token}@gl.ab" + context 'incoming email enabled' do + before do + stub_incoming_email_setting(enabled: true, address: "p+%{key}@gl.ab") + end + + it 'returns the address to create a new issue' do + token = user.authentication_token + address = "p+#{project.namespace.path}/#{project.path}+#{token}@gl.ab" - expect(project.new_issue_address(user)).to eq(address) + expect(project.new_issue_address(user)).to eq(address) + end + end + + context 'incoming email disabled' do + before do + stub_incoming_email_setting(enabled: false) + end + + it 'returns nil' do + expect(project.new_issue_address(user)).to be_nil + end end end |