2019-06-11 22:24:35 +00:00
|
|
|
require "helper"
|
|
|
|
require "inspec/resource"
|
|
|
|
require "inspec/resources/cran"
|
2017-10-25 14:14:29 +00:00
|
|
|
|
2019-06-11 22:24:35 +00:00
|
|
|
describe "Inspec::Resources::Cran" do
|
|
|
|
it "verify cran package detail parsing" do
|
|
|
|
resource = load_resource("cran", "DBI")
|
|
|
|
pkg = { type: "cran", name: "DBI", version: "0.5.1", installed: true }
|
2017-10-25 14:14:29 +00:00
|
|
|
_(resource.installed?).must_equal true
|
|
|
|
_(resource.info).must_equal pkg
|
|
|
|
end
|
2019-06-11 22:24:35 +00:00
|
|
|
it "verify info for non-installed packages" do
|
|
|
|
resource = load_resource("cran", "DoesNotExist")
|
2017-10-25 14:14:29 +00:00
|
|
|
_(resource.installed?).must_equal false
|
|
|
|
_(resource.version).must_be_nil
|
2019-06-11 22:24:35 +00:00
|
|
|
_(resource.info[:name]).must_equal "DoesNotExist"
|
|
|
|
_(resource.info[:type]).must_equal "cran"
|
2017-10-25 14:14:29 +00:00
|
|
|
end
|
2022-06-02 09:03:53 +00:00
|
|
|
it "gets resource_id for the current resource" do
|
|
|
|
resource = load_resource("cran", "DBI")
|
|
|
|
_(resource.resource_id).must_equal "DBI"
|
|
|
|
end
|
2017-10-25 14:14:29 +00:00
|
|
|
end
|