Skip to content

Commit

Permalink
test: sort list of version numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed May 1, 2020
1 parent cce7cd0 commit db59ba3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions spec/lib/pact_broker/domain/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def find_version(number)
end

def version_numbers
subject.collect(&:number)
subject.collect(&:number).sort_by(&:to_i)
end

context "when selecting the latest prod versions without a pacticipant name" do
Expand Down Expand Up @@ -63,7 +63,7 @@ def version_numbers
let(:selector) { PactBroker::Matrix::UnresolvedSelector.new(tag: 'prod') }

it "selects all the production versions without a pacticipant name" do
expect(version_numbers.sort).to eq %w{1 10 11 2}
expect(version_numbers).to eq %w{1 2 10 11}
end
end

Expand All @@ -82,14 +82,14 @@ def version_numbers
let(:selector) { PactBroker::Matrix::UnresolvedSelector.new(tag: true, latest: true) }

it "selects the head versions for each tag" do
expect(version_numbers.sort).to eq %w{11 2 4}
expect(version_numbers).to eq %w{2 4 11}
end

context "when also specifying pacticipant name" do
let(:selector) { PactBroker::Matrix::UnresolvedSelector.new(tag: true, latest: true, pacticipant_name: "Foo") }

it "selects the head versions for each tag for the given pacticipant" do
expect(version_numbers.sort).to eq %w{2 4}
expect(version_numbers).to eq %w{2 4}
end
end
end
Expand All @@ -109,14 +109,14 @@ def version_numbers
let(:selector) { PactBroker::Matrix::UnresolvedSelector.new(tag: true) }

it "selects every version with a tag" do
expect(version_numbers.sort).to eq %w{1 10 2 4}
expect(version_numbers).to eq %w{1 2 4 10}
end

context "when also specifying pacticipant name" do
let(:selector) { PactBroker::Matrix::UnresolvedSelector.new(tag: true, pacticipant_name: "Foo") }

it "selects every version with a tag for the given pacticipant" do
expect(version_numbers.sort).to eq %w{1 2 4}
expect(version_numbers).to eq %w{1 2 4}
end
end
end
Expand All @@ -137,7 +137,7 @@ def version_numbers
let(:four_days_ago) { Date.today - 4 }

it "selects the consumer versions younger than the max age" do
expect(version_numbers.sort).to eq %w{2 3}
expect(version_numbers).to eq %w{2 3}
end
end
end
Expand Down

0 comments on commit db59ba3

Please sign in to comment.