Skip to content

Commit

Permalink
Add test coverage for debian version field validation
Browse files Browse the repository at this point in the history
For #1847
  • Loading branch information
jordansissel committed Dec 4, 2022
1 parent f898ef8 commit 3150610
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions spec/fpm/package/deb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,28 @@
end

context "when validating the version field" do
pending "it should reject invalid versions"
pending "it should convert v-prefixed-but-otherwise-valid versions"
pending "it should accept valid versions"
[ "_", "1_2", "abc def", "%", "1^a"].each do |v|
it "should reject as invalid, '#{v}'" do
subject.version = v
insist { subject.version }.raises FPM::InvalidPackageConfiguration
end
end

[ "1", "1.2", "1.2.3", "20200101", "1~beta", "1whatever"].each do |v|
it "should accept '#{v}'" do
subject.version = v

# should not raise exception
insist { subject.version } == v
end

it "should remove a leading 'v' from v#{v} and still accept it" do
subject.version = "v#{v}"

# should not raise exception
insist { subject.version } == v
end
end
end

describe "#output" do
Expand Down

0 comments on commit 3150610

Please sign in to comment.