Sha256: f9218486a73f74a4e4f48211d98dabd72c1492b13b65b902c1cfe0a4e9679d43
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
require "webmock/rspec" describe "get latest pact badge" do before do PactBroker.configuration.enable_public_badge_access = true TestDataBuilder.new .create_consumer("consumer") .create_provider("provider") .create_consumer_version("1.2.3") .create_pact .create_verification end let!(:http_request) do stub_request(:get, /http/).to_return(:status => 200, :body => "<svg/>") end let(:path) { "/pacts/provider/provider/consumer/consumer/latest/badge" } # In the full app, the .svg extension is turned into an Accept header # by ConvertFileExtensionToAcceptHeader subject { get path, nil, {"HTTP_ACCEPT" => "image/svg+xml"}; last_response } it "returns a 200 status" do expect(subject.status).to eq 200 end it "returns an svg/xml response" do expect(subject.headers["Content-Type"]).to include("image/svg+xml") end it "returns an svg body" do expect(subject.body).to include "<svg/>" end context "when the pact doesn't exist" do let(:path) { "/pacts/provider/foo/consumer/bar/latest/badge" } it "returns a 200 status" do expect(subject.status).to eq 200 end it "returns an svg/xml response" do expect(subject.headers["Content-Type"]).to include("image/svg+xml") end it "returns a static svg image" do expect(subject.body).to include ">unknown<" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pact_broker-2.81.0 | spec/features/get_latest_pact_badge_spec.rb |
pact_broker-2.80.0 | spec/features/get_latest_pact_badge_spec.rb |