Sha256: d0ecd7eb85daab26199fa1771cc679f172d5e6c6bc10e4c070a75b9742fcd2ee

Contents?: true

Size: 1.51 KB

Versions: 18

Compression:

Stored size: 1.51 KB

Contents

require 'spec/support/provider_state_builder'

describe "Get diff between versions" do

  let(:path) { "/pacts/provider/Provider/consumer/Consumer/version/3/diff/previous-distinct" }

  let(:last_response_body) { subject.body }

  subject { get path; last_response }

  let(:pact_content_version_1) do
    hash = load_json_fixture('consumer-provider.json')
    hash['interactions'].first['request']['method'] = 'post'
    hash.to_json
  end
  let(:pact_content_version_2) { load_fixture('consumer-provider.json') }
  let(:pact_content_version_3) { pact_content_version_2 }

  before do
    ProviderStateBuilder.new
      .create_consumer("Consumer")
      .create_provider("Provider")
      .create_consumer_version("1")
      .create_pact(pact_content_version_1)
      .create_consumer_version("2")
      .create_pact(pact_content_version_2)
      .create_consumer_version("3")
      .create_pact(pact_content_version_3)
  end

  context "when the versions exist" do

    it "returns a 200 text response" do
      expect(subject.headers['Content-Type']).to eq "text/plain;charset=utf-8"
    end

    it "returns the JSON representation of the diff" do
      expect(last_response_body).to include('"method": "post"')
      expect(last_response_body).to include('"method": "get"')
    end

  end

  context "when either version does not exist" do

    let(:path) { "/pacts/provider/Provider/consumer/Consumer/versions/1/diff/previous-distinct" }

    it "returns a 404 response" do
      expect(subject).to be_a_404_response
    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pact_broker-2.0.0.beta.7 spec/features/get_diff_spec.rb
pact_broker-2.0.0.beta.6 spec/features/get_diff_spec.rb
pact_broker-1.18.0 spec/features/get_diff_spec.rb
pact_broker-2.0.0.beta.5 spec/features/get_diff_spec.rb
pact_broker-1.18.0.beta.1 spec/features/get_diff_spec.rb
pact_broker-1.17.2 spec/features/get_diff_spec.rb
pact_broker-1.17.1 spec/features/get_diff_spec.rb
pact_broker-2.0.0.beta.4 spec/features/get_diff_spec.rb
pact_broker-2.0.0.beta.3 spec/features/get_diff_spec.rb
pact_broker-2.0.0.beta.2 spec/features/get_diff_spec.rb
pact_broker-2.0.0.beta.1 spec/features/get_diff_spec.rb
pact_broker-1.17.0 spec/features/get_diff_spec.rb
pact_broker-1.16.0 spec/features/get_diff_spec.rb
pact_broker-1.15.0 spec/features/get_diff_spec.rb
pact_broker-1.14.0 spec/features/get_diff_spec.rb
pact_broker-1.13.0 spec/features/get_diff_spec.rb
pact_broker-1.12.0 spec/features/get_diff_spec.rb
pact_broker-1.11.2 spec/features/get_diff_spec.rb