Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

73 lines (60 sloc) 2.099 kb
require "spec_setup"
require "fpm" # local
require "fpm/package/osxpkg" # local
describe FPM::Package::OSXpkg do
if %x{uname -s}.chomp != "Darwin"
Cabin::Channel.get("rspec").warn("Skipping OS X tests because " \
"this system is #{%x{uname -s}.chomp}, Darwin required")
end
describe "#identifier" do
it "should be of the form reverse.domain.pkgname" do
subject.name = "name"
subject.attributes[:osxpkg_identifier_prefix] = "org.great"
insist { subject.identifier } == \
"#{subject.attributes[:osxpkg_identifier_prefix]}.#{subject.name}"
end
it "should be the name only if a prefix was not given" do
subject.name = "name"
subject.attributes[:osxpkg_identifier_prefix] = nil
insist { subject.identifier } == subject.name
end
end
describe "#to_s" do
it "should have a default output usable as a filename" do
subject.name = "name"
subject.version = "123"
# We like the format 'name-version.pkg'
insist { subject.to_s } == "name-123.pkg"
end
end
describe "#output" do
before :all do
# output a package, use it as the input, set the subject to that input
# package. This helps ensure that we can write and read packages
# properly.
tmpfile = Tempfile.new("fpm-test-osxpkg")
@target = tmpfile.path
# The target file must not exist.
tmpfile.unlink
@original = FPM::Package::OSXpkg.new
@original.name = "name"
@original.version = "123"
@original.attributes[:osxpkg_identifier_prefix] = "org.my"
@original.output(@target)
@input = FPM::Package::OSXpkg.new
@input.input(@target)
end
after :all do
@original.cleanup
@input.cleanup
end # after
context "package attributes" do
it "should have the correct name" do
insist { @input.name } == @original.name
end
it "should have the correct version" do
insist { @input.version } == @original.version
end
end # package attributes
end # #output
end # describe FPM::Package:OSXpkg
Jump to Line
Something went wrong with that request. Please try again.