Sha256: 26cbf526c40b575fb1b9bd9639e20342bc3f79df20cc2bb369f91ce5c739e185

Contents?: true

Size: 1.81 KB

Versions: 102

Compression:

Stored size: 1.81 KB

Contents

# -*- ruby -*-
require 'spec_helper'
require 'packaging/deb'

describe 'deb.rb' do
  describe "#set_cow_envs" do
    before(:each) do
      reset_env(["DIST", "ARCH", "PE_VER", "BUILDMIRROR"])
      Pkg::Config.deb_build_mirrors = nil
      Pkg::Config.build_pe = nil
      Pkg::Config.pe_version = nil
    end

    after(:all) do
      reset_env(["DIST", "ARCH", "PE_VER", "BUILDMIRROR"])
      Pkg::Config.deb_build_mirrors = nil
      Pkg::Config.build_pe = nil
      Pkg::Config.pe_version = nil
    end

    it "should always set DIST and ARCH correctly" do
      Pkg::Deb.send(:set_cow_envs, "base-wheezy-i386.cow")
      ENV["DIST"].should eq("wheezy")
      ENV["ARCH"].should eq("i386")
      ENV["PE_VER"].should be_nil
      ENV["BUILDMIRROR"].should be_nil
    end

    it "should set BUILDMIRROR if Pkg::Config.deb_build_mirrors is set" do
      Pkg::Config.deb_build_mirrors = ["deb http://pl-build-tools.delivery.puppetlabs.net/debian __DIST__ main", "deb http://debian.is.awesome/wait no it is not"]
      Pkg::Deb.send(:set_cow_envs, "base-wheezy-i386.cow")
      ENV["DIST"].should eq("wheezy")
      ENV["ARCH"].should eq("i386")
      ENV["PE_VER"].should be_nil
      ENV["BUILDMIRROR"].should eq("deb http://pl-build-tools.delivery.puppetlabs.net/debian wheezy main | deb http://debian.is.awesome/wait no it is not")
    end

    it "should set PE_VER if Pkg::Config.build_pe is truthy" do
      Pkg::Config.build_pe = true
      Pkg::Config.pe_version = "3.2"
      Pkg::Deb.send(:set_cow_envs, "base-wheezy-i386.cow")
      ENV["DIST"].should eq("wheezy")
      ENV["ARCH"].should eq("i386")
      ENV["PE_VER"].should eq("3.2")
      ENV["BUILDMIRROR"].should be_nil
    end

    it "should fail on a badly formatted cow" do
      expect { Pkg::Deb.send(:set_cow_envs, "wheezy-i386") }.to raise_error(RuntimeError)
    end
  end
end

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
packaging-0.99.77 spec/lib/packaging/deb_spec.rb
packaging-0.88.77 spec/lib/packaging/deb_spec.rb
packaging-0.99.76 spec/lib/packaging/deb_spec.rb
packaging-0.99.75 spec/lib/packaging/deb_spec.rb
packaging-0.99.74 spec/lib/packaging/deb_spec.rb
packaging-0.99.73 spec/lib/packaging/deb_spec.rb
packaging-0.99.72 spec/lib/packaging/deb_spec.rb
packaging-0.99.71 spec/lib/packaging/deb_spec.rb
packaging-0.99.70 spec/lib/packaging/deb_spec.rb
packaging-0.99.69 spec/lib/packaging/deb_spec.rb
packaging-0.99.68 spec/lib/packaging/deb_spec.rb
packaging-0.99.67 spec/lib/packaging/deb_spec.rb
packaging-0.99.66 spec/lib/packaging/deb_spec.rb
packaging-0.99.65 spec/lib/packaging/deb_spec.rb
packaging-0.99.64 spec/lib/packaging/deb_spec.rb
packaging-0.99.63 spec/lib/packaging/deb_spec.rb
packaging-0.99.62 spec/lib/packaging/deb_spec.rb
packaging-0.99.61 spec/lib/packaging/deb_spec.rb
packaging-0.99.60 spec/lib/packaging/deb_spec.rb
packaging-0.99.59 spec/lib/packaging/deb_spec.rb