Skip to content

Commit

Permalink
Add test coverage for jordansissel#591
Browse files Browse the repository at this point in the history
This also required fixing some bugs where FPM::Package::Deb mistakenly
made 'provides' a string (in the tests and in the 'input' method)
  • Loading branch information
jordansissel committed Dec 6, 2013
1 parent 0ef614c commit 1b7a1ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/fpm/package/deb.rb
Expand Up @@ -225,7 +225,10 @@ def extract_info(package)
self.name = parse.call("Package")
self.url = parse.call("Homepage")
self.vendor = parse.call("Vendor") || self.vendor
self.provides = parse.call("Provides") || self.provides
with(parse.call("Provides")) do |provides_str|
next if provides_str.nil?
self.provides = provides_str.split(/\s*,\s*/)
end

# The description field is a special flower, parse it that way.
# The description is the first line as a normal Description field, but also continues
Expand Down Expand Up @@ -297,6 +300,7 @@ def extract_files(package)
end # def extract_files

def output(output_path)
self.provides = self.provides.collect { |p| fix_provides(p) }
output_check(output_path)
# Abort if the target path already exists.

Expand Down
11 changes: 9 additions & 2 deletions spec/fpm/package/deb_spec.rb
Expand Up @@ -120,7 +120,10 @@
@original.architecture = "all"
@original.dependencies << "something > 10"
@original.dependencies << "hello >= 20"
@original.provides = "#{@original.name} = #{@original.version}"
@original.provides << "#{@original.name} = #{@original.version}"

# Test to cover PR#591 (fix provides names)
@original.provides << "Some-SILLY_name"

@original.conflicts = ["foo < 123"]
@original.attributes[:deb_breaks] = ["baz < 123"]
Expand Down Expand Up @@ -169,7 +172,11 @@

it "should ignore versions and conditions in 'provides' (#280)" do
# Provides is an array because rpm supports multiple 'provides'
insist { @input.provides } == [ @original.name ]
insist { @input.provides }.include?(@original.name)
end

it "should fix capitalization and underscores-to-dashes (#591)" do
insist { @input.provides }.include?("some-silly-name")
end
end # package attributes

Expand Down

0 comments on commit 1b7a1ce

Please sign in to comment.