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
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-06 02:11:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-06 02:11:43 +0300
commit13d327df4f3c52505bf8ec1144f2dedb6a351ad6 (patch)
tree546e42fe159cde302b5e4d0b923d399e79bfbf71 /spec/lib
parent9a70fcd2e277721bbe7b9a0c92ed925ddea201b6 (diff)
Add latest changes from gitlab-org/gitlab@13-9-stable-ee
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/kroki_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/lib/gitlab/kroki_spec.rb b/spec/lib/gitlab/kroki_spec.rb
new file mode 100644
index 00000000000..31d3edd158b
--- /dev/null
+++ b/spec/lib/gitlab/kroki_spec.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+require 'spec_helper'
+
+RSpec.describe Gitlab::Kroki do
+ using RSpec::Parameterized::TableSyntax
+
+ describe '.formats' do
+ def default_formats
+ %w[bytefield c4plantuml ditaa erd graphviz nomnoml plantuml svgbob umlet vega vegalite wavedrom].freeze
+ end
+
+ subject { described_class.formats(Gitlab::CurrentSettings) }
+
+ where(:enabled_formats, :expected_formats) do
+ '' | default_formats
+ 'blockdiag' | default_formats + %w[actdiag blockdiag nwdiag packetdiag rackdiag seqdiag]
+ 'bpmn' | default_formats + %w[bpmn]
+ 'excalidraw' | default_formats + %w[excalidraw]
+ end
+
+ with_them do
+ before do
+ kroki_formats =
+ if enabled_formats.present?
+ { enabled_formats => true }
+ else
+ {}
+ end
+
+ stub_application_setting(kroki_enabled: true, kroki_url: "http://localhost:8000", kroki_formats: kroki_formats)
+ end
+
+ it 'returns the expected formats' do
+ expect(subject).to match_array(expected_formats)
+ end
+ end
+ end
+end