Sha256: 9459ff3d39e8762d154ee2ca116ea98a2a93b5c4e2a0126814969ad4b30cfbf3

Contents?: true

Size: 1.49 KB

Versions: 11

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'
require 'pact_broker/pacticipants/repository'
require 'support/provider_state_builder'

module PactBroker
  module Pacticipants
    describe Repository do

      describe "#find_by_name" do
        before do
          ProviderStateBuilder.new.create_pacticipant("Foo Bar")
        end

        subject { Repository.new.find_by_name('foo bar') }

        context "when the name is a different case" do
          context "with case sensitivity turned on" do
            before do
              allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(true)
            end

            it "returns nil" do
              expect(subject).to be nil
            end
          end

          context "with case sensitivity turned off" do
            before do
              allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(false)
            end

            it "returns the pacticipant" do
              expect(subject).to_not be nil
              expect(subject.name).to eq "Foo Bar"
            end
          end
        end
      end

      describe "#pacticipant_names" do

        before do
          ProviderStateBuilder.new
            .create_pacticipant("Plants")
            .create_pacticipant("Animals")
        end

        subject { Repository.new.pacticipant_names }

        it "returns an array of pacticipant names" do
          expect(subject).to eq ["Animals", "Plants"]
        end

      end


    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pact_broker-2.0.0.beta.6 spec/lib/pact_broker/pacticipants/repository_spec.rb
pact_broker-2.0.0.beta.5 spec/lib/pact_broker/pacticipants/repository_spec.rb
pact_broker-1.18.0.beta.1 spec/lib/pact_broker/pacticipants/repository_spec.rb
pact_broker-1.17.2 spec/lib/pact_broker/pacticipants/repository_spec.rb
pact_broker-1.17.1 spec/lib/pact_broker/pacticipants/repository_spec.rb
pact_broker-2.0.0.beta.4 spec/lib/pact_broker/pacticipants/repository_spec.rb
pact_broker-2.0.0.beta.3 spec/lib/pact_broker/pacticipants/repository_spec.rb
pact_broker-2.0.0.beta.2 spec/lib/pact_broker/pacticipants/repository_spec.rb
pact_broker-2.0.0.beta.1 spec/lib/pact_broker/pacticipants/repository_spec.rb
pact_broker-1.17.0 spec/lib/pact_broker/pacticipants/repository_spec.rb
pact_broker-1.16.0 spec/lib/pact_broker/pacticipants/repository_spec.rb