diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-31 17:36:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-31 17:37:06 +0300 |
commit | 8e13b6a8759a43bb8a90444139b4fbb4205a1b74 (patch) | |
tree | 7db3bb37340fbaec54819ff688ecaefc2d406c59 /spec | |
parent | 1ebdda69d61ae26379f8fac27671103374031944 (diff) |
Add latest changes from gitlab-org/security/gitlab@16-2-stable-ee
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/plantuml_spec.rb | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/spec/lib/gitlab/plantuml_spec.rb b/spec/lib/gitlab/plantuml_spec.rb new file mode 100644 index 00000000000..c783dd66c48 --- /dev/null +++ b/spec/lib/gitlab/plantuml_spec.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +require "spec_helper" + +RSpec.describe Gitlab::Plantuml, feature_category: :shared do + describe ".configure" do + subject { described_class.configure } + + let(:plantuml_url) { "http://plantuml.foo.bar" } + + before do + allow(Gitlab::CurrentSettings).to receive(:plantuml_url).and_return(plantuml_url) + end + + context "when PlantUML is enabled" do + before do + allow(Gitlab::CurrentSettings).to receive(:plantuml_enabled).and_return(true) + end + + it "configures the endpoint URL" do + expect(subject.url).to eq(plantuml_url) + end + + it "enables PNG support" do + expect(subject.png_enable).to be_truthy + end + + it "disables SVG support" do + expect(subject.svg_enable).to be_falsey + end + + it "disables TXT support" do + expect(subject.txt_enable).to be_falsey + end + end + + context "when PlantUML is disabled" do + before do + allow(Gitlab::CurrentSettings).to receive(:plantuml_enabled).and_return(false) + end + + it "configures the endpoint URL" do + expect(subject.url).to eq(plantuml_url) + end + + it "enables PNG support" do + expect(subject.png_enable).to be_falsey + end + + it "disables SVG support" do + expect(subject.svg_enable).to be_falsey + end + + it "disables TXT support" do + expect(subject.txt_enable).to be_falsey + end + end + end +end |