Sha256: f682f6ed443d6f65a3f3ee4d25822b2575d4a9c806bc578f3b8f2f3e313d0101
Contents?: true
Size: 1.91 KB
Versions: 17
Compression:
Stored size: 1.91 KB
Contents
require 'pact_broker/matrix/repository' module PactBroker module Matrix describe Repository do let(:td) { TestDataBuilder.new} def build_selectors(hash) hash.collect do | key, value | { pacticipant_name: key, pacticipant_version_number: value } end end def shorten_row row "#{row[:consumer_name]}#{row[:consumer_version_number]} #{row[:provider_name]}#{row[:provider_version_number] || '?'} n#{row[:verification_number] || '?'}" end def shorten_rows rows rows.collect{ |r| shorten_row(r) } end describe "find when deploying a provider to prod for the first time and the consumer has not been deployed yet" do before do td.create_pact_with_hierarchy("Foo", "1", "Bar") .create_verification(provider_version: "2") end let(:selectors) { [ { pacticipant_name: "Bar", pacticipant_version_number: "2" } ] } let(:options) { { latest: true, tag: "prod"} } subject { shorten_rows(rows) } let(:rows) { Repository.new.find(selectors, options) } it "returns an empty array" do expect(rows).to eq [] end end describe "find when deploying a consumer to prod for the first time and the provider has not been deployed yet" do before do td.create_pact_with_hierarchy("Foo", "1", "Bar") .create_verification(provider_version: "2") end let(:selectors) { [ { pacticipant_name: "Foo", pacticipant_version_number: "1" } ] } let(:options) { { latest: true, tag: "prod"} } subject { shorten_rows(rows) } let(:results) { Repository.new.find(selectors, options) } it "returns an empty array" do expect(results).to eq [] expect(results.resolved_selectors.find{ |s | s[:pacticipant_name] == "Bar"}[:pacticipant_version_id]).to eq -1 end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems