Sha256: b86fa95ea67a640bebf8e301f92d524fefa8f0846219efdedec74b7ca21a3f28

Contents?: true

Size: 1.17 KB

Versions: 67

Compression:

Stored size: 1.17 KB

Contents

require 'pact_broker/pacts/generate_interaction_sha'

module PactBroker
  module Pacts
    describe GenerateInteractionSha do
      describe ".call" do
        let(:interaction_hash) do
          {
            "description" => "foo",
            "providerStates" => [
              "name" => "bar",
              "params" => {
                "wiffle" => "bar",
                "meep" => "eek"
              }
            ]
          }
        end

        let(:interaction_hash_with_different_key_order) do
          {
            "providerStates" => [
              "name" => "bar",
              "params" => {
                "meep" => "eek",
                "wiffle" => "bar"
              }
            ],
            "description" => "foo"
          }
        end

        subject { GenerateInteractionSha.call(interaction_hash) }

        it "generates a SHA based on the sorted keys" do
          expect(subject).to eq "57d06e151eca35083e4d6b585b4d4fab2e2ed6b7"
        end

        it "generates the same SHA if the keys are ordered differently" do
          expect(subject).to eq GenerateInteractionSha.call(interaction_hash_with_different_key_order)
        end
      end
    end
  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
pact_broker-2.79.1 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.79.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.78.1 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.78.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.77.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.76.2 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.76.1 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.76.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.75.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.74.1 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.74.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.73.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.72.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.71.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.70.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.69.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.68.1 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.68.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.67.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb
pact_broker-2.66.0 spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb