Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/import_formatter_spec.rb')
-rw-r--r--spec/lib/gitlab/import_formatter_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/lib/gitlab/import_formatter_spec.rb b/spec/lib/gitlab/import_formatter_spec.rb
new file mode 100644
index 00000000000..e9f63ba5777
--- /dev/null
+++ b/spec/lib/gitlab/import_formatter_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Gitlab::ImportFormatter do
+ let(:formatter) { Gitlab::ImportFormatter.new }
+
+ describe '#comment' do
+ it 'creates the correct string' do
+ expect(formatter.comment('Name', '2020-02-02', 'some text')).to eq(
+ "\n\n*By Name on 2020-02-02*\n\nsome text"
+ )
+ end
+ end
+
+ describe '#author_line' do
+ it 'returns the correct string with provided author name' do
+ expect(formatter.author_line('Name')).to eq("*Created by: Name*\n\n")
+ end
+
+ it 'returns the correct string with Anonymous name if author not provided' do
+ expect(formatter.author_line(nil)).to eq("*Created by: Anonymous*\n\n")
+ end
+ end
+
+ describe '#assignee_line' do
+ it 'returns the correct string with provided author name' do
+ expect(formatter.assignee_line('Name')).to eq("*Assigned to: Name*\n\n")
+ end
+
+ it 'returns the correct string with Anonymous name if author not provided' do
+ expect(formatter.assignee_line(nil)).to eq("*Assigned to: Anonymous*\n\n")
+ end
+ end
+end