Commit 9177d6ef authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch 'kassio/github-importer-avoid-failing-when-issuable-has-no-body' into 'master'

GithubImporter: Avoid failing when PullRequest has empty body

See merge request gitlab-org/gitlab!64558
parents 5d44287e 2e5585ac
...@@ -13,7 +13,7 @@ module Gitlab ...@@ -13,7 +13,7 @@ module Gitlab
# author - An instance of `Gitlab::GithubImport::Representation::User` # author - An instance of `Gitlab::GithubImport::Representation::User`
# exists - Boolean that indicates the user exists in the GitLab database. # exists - Boolean that indicates the user exists in the GitLab database.
def initialize(text, author, exists = false) def initialize(text, author, exists = false)
@text = text @text = text.to_s
@author = author @author = author
@exists = exists @exists = exists
end end
......
...@@ -27,6 +27,13 @@ RSpec.describe Gitlab::GithubImport::MarkdownText do ...@@ -27,6 +27,13 @@ RSpec.describe Gitlab::GithubImport::MarkdownText do
expect(text.to_s).to eq('Hello') expect(text.to_s).to eq('Hello')
end end
it 'returns empty text when it receives nil' do
author = double(:author, login: nil)
text = described_class.new(nil, author, true)
expect(text.to_s).to eq('')
end
it 'returns the text with an extra header when the author was not found' do it 'returns the text with an extra header when the author was not found' do
author = double(:author, login: 'Alice') author = double(:author, login: 'Alice')
text = described_class.new('Hello', author) text = described_class.new('Hello', author)
......
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