Sha256: 0c71fff5513c734ddc2febcaa48e91fe16f9579b868e68c27d6fbf8657abfc99

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

require "pact_broker/ui/app"

describe "UI index" do
  let(:app) { PactBroker::UI::App.new }
  let(:params) { {} }

  before do
    td.create_pact_with_hierarchy("Foo", "1", "Bar")
      .create_consumer_version_tag("prod")
      .create_consumer_version("2")
      .create_pact
    get "/"
  end

  let(:rack_env) { {} }

  subject { get("/", params, rack_env) }

  describe "GET" do
    it "returns a success response" do
      expect(subject.status).to eq 200
    end

    it "returns a table of pacts" do
      expect(subject.body.scan("<tr").to_a.size).to eq 2
    end

    context "with an array of tags" do
      let(:params) { { tags: ["prod"] } }

      it "returns a table of pacts with the specfied tags" do
        expect(subject.body.scan("<tr").to_a.size).to eq 3
      end
    end

    context "with the base_url not set" do
      it "returns relative links" do
        expect(subject.body).to include "href='/stylesheets"
      end
    end

    context "with the base_url set" do
      let(:rack_env) { { "pactbroker.base_url" => "http://example.org/pact-broker"} }

      it "returns absolute links" do
        expect(subject.body).to include "href='http://example.org/pact-broker/stylesheets"
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/integration/ui/index_spec.rb
pact_broker-2.89.0 spec/integration/ui/index_spec.rb
pact_broker-2.88.0 spec/integration/ui/index_spec.rb
pact_broker-2.87.0 spec/integration/ui/index_spec.rb
pact_broker-2.86.0 spec/integration/ui/index_spec.rb
pact_broker-2.85.1 spec/integration/ui/index_spec.rb
pact_broker-2.85.0 spec/integration/ui/index_spec.rb
pact_broker-2.84.0 spec/integration/ui/index_spec.rb