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

plantuml_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c783dd66c48ad212132427258b238d80d0f67040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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