Sha256: 8387b2d654381a9803a6808fb19c2105f206876d4a83aeb00c74fe18f491dabc
Contents?: true
Size: 1.28 KB
Versions: 12
Compression:
Stored size: 1.28 KB
Contents
require "spec_helper" require "pact_broker/versions/parse_semantic_version" module PactBroker module Versions describe ParseSemanticVersion do describe ".call" do context "when parsing a semantic version" do subject { ParseSemanticVersion.call("1.2.3") } it "returns the version" do expect(subject.major).to eq 1 expect(subject.minor).to eq 2 expect(subject.to_s).to eq "1.2.3" end it "returns a comparable version" do expect(subject).to be > ParseSemanticVersion.call("1.2.2") expect(subject).to be == ParseSemanticVersion.call("1.2.3") expect(subject).to be < ParseSemanticVersion.call("1.3.1") end it "allows versions with one or two parts for backwards compatibility" do expect(ParseSemanticVersion.call("1")).to eq ::SemVer.new(1,0,0) expect(ParseSemanticVersion.call("1.2")).to eq ::SemVer.new(1,2,0) end it "returns nil when version is invalid" do expect(ParseSemanticVersion.call("abc")).to be_nil end it "accepts semver metadata" do expect(ParseSemanticVersion.call("1.2.3+abc.234")).not_to be_nil end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems