Sha256: d45720e71927db318a97854d84797d34d4671b5567674b33c579cccbef4bf116

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

require 'test_helper'

describe Rupert::RPM do
  let(:valid_rpm)   { fixture('rpm-4.8.0-32.el6.x86_64.rpm') }
  let(:invalid_rpm) { fixture('notanrpm-0.0.1-1.el6.noarch.rpm') }
  let(:bin_rpm)     { fixture('rpm-4.8.0-32.el6.x86_64.rpm') }
  let(:src_rpm)     { fixture('redhat-lsb-4.0-7.el6.centos.src.rpm') }

  let(:rpm)         { Rupert::RPM.load(valid_rpm) }
  let(:binary_rpm)  { Rupert::RPM.load(bin_rpm) }
  let(:source_rpm)  { Rupert::RPM.load(src_rpm) }

  it "correctly loads a valid RPM" do
    Rupert::RPM.load(valid_rpm)
  end

  it "raises an error if the RPM is not in valid format" do
    proc {
      Rupert::RPM.load(invalid_rpm)
    }.must_raise Rupert::NotAnRPM
  end

  it "knows which version of RPM the file is" do
    rpm.rpm_version.must_equal "3.0"
  end

  it "tells which architecture the package is built for" do
    rpm.rpm_arch.must_equal "i386/x86_64"
  end

  it "tells if the file is a binary or source RPM" do
    assert binary_rpm.binary?, "failed to recognize RPM as binary"
    refute binary_rpm.source?, "RPM misrecognized as of source type"

    assert source_rpm.source?, "failed to recognize RPM as source"
    refute source_rpm.binary?, "RPM misrecognized as of binary type"
  end

  it "tells the package's name" do
    rpm.name.must_equal "rpm-4.8.0-32.el6"
  end

  it "tells the operating system for which the package has been built" do
    rpm.os.must_equal "Linux"
  end

  it "tells if package is signed" do
    assert rpm.signed?, "expected the package to be signed, but it was not"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rupert-0.0.1 test/end_to_end/rpm_test.rb