Sha256: 93596be0170d645cb726dffee6815c22d31bea36589377345687dbf3ac1565a6

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'
require 'pact_broker/repositories/version_repository'

module PactBroker
  module Repositories
    describe VersionRepository do

      describe "#find_by_pacticipant_name_and_number" do

        let(:pacticipant_name) { "test_pacticipant" }
        let(:version_number) { "1.2.3" }

        subject { described_class.new.find_by_pacticipant_name_and_number pacticipant_name, version_number }

        context "when the version exists" do
          before do
            ProviderStateBuilder.new.create_version_with_hierarchy "other_pacticipant", version_number
            ProviderStateBuilder.new.create_version_with_hierarchy pacticipant_name, version_number
          end

          it "returns the version" do
            expect(subject.number).to eq version_number
            expect(subject.pacticipant.name).to eq pacticipant_name
          end
        end

        context "when the version doesn't exist" do
          it "returns nil" do
            expect(subject).to be_nil
          end
        end

      end


    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pact_broker-1.2.0 spec/lib/pact_broker/repositories/version_repository_spec.rb
pact_broker-1.1.0 spec/lib/pact_broker/repositories/version_repository_spec.rb
pact_broker-1.0.0 spec/lib/pact_broker/repositories/version_repository_spec.rb
pact_broker-1.0.0.alpha3 spec/lib/pact_broker/repositories/version_repository_spec.rb
pact_broker-1.0.0.alpha2 spec/lib/pact_broker/repositories/version_repository_spec.rb
pact_broker-1.0.0.alpha1 spec/lib/pact_broker/repositories/version_repository_spec.rb
pact_broker-0.0.10 spec/lib/pact_broker/repositories/version_repository_spec.rb