b04f95a2ed
* upstream/master: (620 commits) Added '*.js.es6 gitlab-language=javascript' to .gitattributes Fix CI status icon link underline Update CHANGELOG after 8.10.1 Add CHANGELOG Add es6 gem Instrument Nokogiri parsing methods Fix backup restore Use project ID in repository cache to prevent stale data from persisting across projects Add iid to MR API response `WikiPage` should have a slug even when not persisted. ES6ify all the things! Make fork counter always clickable (!5463) Revert "Merge branch '17073-tagscontroller-index-is-terrible-response-time-goes-up-to-5-…" Fix CHANGELOG Add spec for dashes in paths Fix Error 500 when creating Wiki pages with hyphens or spaces Add links to the real markdown.md file for all GFM examples Remove magic comments from Ruby files (!5456) Ignore invalid trusted proxies in X-Forwarded-For header remove search_id for label dropdown filter ...
41 lines
1 KiB
Ruby
41 lines
1 KiB
Ruby
require 'gitlab/email/receiver'
|
|
|
|
shared_context :email_shared_context do
|
|
let(:mail_key) { "59d8df8370b7e95c5a49fbf86aeb2c93" }
|
|
let(:receiver) { Gitlab::Email::Receiver.new(email_raw) }
|
|
let(:markdown) { "![image](uploads/image.png)" }
|
|
|
|
def setup_attachment
|
|
allow_any_instance_of(Gitlab::Email::AttachmentUploader).to receive(:execute).and_return(
|
|
[
|
|
{
|
|
url: "uploads/image.png",
|
|
alt: "image",
|
|
markdown: markdown
|
|
}
|
|
]
|
|
)
|
|
end
|
|
end
|
|
|
|
shared_examples :email_shared_examples do
|
|
context "when the user could not be found" do
|
|
before do
|
|
user.destroy
|
|
end
|
|
|
|
it "raises a UserNotFoundError" do
|
|
expect { receiver.execute }.to raise_error(Gitlab::Email::UserNotFoundError)
|
|
end
|
|
end
|
|
|
|
context "when the user is not authorized to the project" do
|
|
before do
|
|
project.update_attribute(:visibility_level, Project::PRIVATE)
|
|
end
|
|
|
|
it "raises a ProjectNotFound" do
|
|
expect { receiver.execute }.to raise_error(Gitlab::Email::ProjectNotFound)
|
|
end
|
|
end
|
|
end
|