Sha256: 95524e15d46933b79c5830f288966e1398e4e322a0c7206090f6b6538ddb2e7e

Contents?: true

Size: 2 KB

Versions: 43

Compression:

Stored size: 2 KB

Contents

require 'pact_broker/doc/controllers/app'

module PactBroker
  module Doc
    module Controllers
      describe App do

        describe "GET relation" do

          let(:app) { PactBroker::Doc::Controllers::App }

          context "when the resource exists" do
            subject { get "/webhooks" }

            it "returns a 200 status" do
              subject
              expect(last_response.status).to eq 200
            end

            it "returns a html content type" do
              subject
              expect(last_response.headers['Content-Type']).to eq "text/html;charset=utf-8"
            end

            it "returns a html body" do
              subject
              expect(last_response.body).to include "<html>"
            end
          end

          context "when the resource does not exist" do
            subject { get "/blah" }

            it "returns a 200 status, because otherwise, the Rack cascade will make it return a 404 from the webmachine API" do
              subject
              expect(last_response.status).to eq 200
            end

            it "returns a html content type" do
              subject
              expect(last_response.headers['Content-Type']).to eq "text/html;charset=utf-8"
            end

            it "returns a custom error page" do
              subject
              expect(last_response.body).to include "No documentation exists"
            end
          end

          context "when the resource has a context and there is a folder with a matching name" do
            subject { get "/diff?context=pact" }

            it "returns documentation in a folder of the matching name" do
              subject
              expect(last_response.status).to eq 200
              expect(last_response.body).to include "Diff"
            end

            it "returns a html content type" do
              subject
              expect(last_response.headers['Content-Type']).to eq "text/html;charset=utf-8"
            end
          end
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
pact_broker-2.55.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.54.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.53.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.52.2 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.52.1 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.52.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.51.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.50.1 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.50.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.49.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.48.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.47.1 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.47.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.46.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.45.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.44.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.43.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.42.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.41.0 spec/lib/pact_broker/doc/controllers/app_spec.rb
pact_broker-2.40.0 spec/lib/pact_broker/doc/controllers/app_spec.rb