Commit 2e5585ac authored by Kassio Borges's avatar Kassio Borges
parent 9a767309
...@@ -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