diff --git a/lib/serverspec/matcher/be_installed.rb b/lib/serverspec/matcher/be_installed.rb index 6d62100d..5d815208 100644 --- a/lib/serverspec/matcher/be_installed.rb +++ b/lib/serverspec/matcher/be_installed.rb @@ -1,6 +1,17 @@ RSpec::Matchers.define :be_installed do match do |name| - name.installed?(@provider, @version) + if subject.class.name == 'Serverspec::Type::SelinuxModule' + name.installed?(@version) + else + name.installed?(@provider, @version) + end + end + + description do + message = 'be installed' + message << %( by "#{@provider}") if @provider + message << %( with version "#{@version}") if @version + message end chain :by do |provider| diff --git a/lib/serverspec/type/selinux_module.rb b/lib/serverspec/type/selinux_module.rb index bbcfb601..924238cd 100644 --- a/lib/serverspec/type/selinux_module.rb +++ b/lib/serverspec/type/selinux_module.rb @@ -4,8 +4,12 @@ def enabled? @runner.check_selinux_module_is_enabled(@name) end - def installed?(name, version=nil) + def installed?(version = nil) @runner.check_selinux_module_is_installed(@name, version) end + + def to_s + %(SELinux module "#{@name}") + end end end diff --git a/spec/type/linux/selinux_module_spec.rb b/spec/type/linux/selinux_module_spec.rb index a62be6b8..7446dc07 100644 --- a/spec/type/linux/selinux_module_spec.rb +++ b/spec/type/linux/selinux_module_spec.rb @@ -4,6 +4,10 @@ describe selinux_module('bootloader') do it { should be_installed } +end + +describe selinux_module('bootloader') do + it { should be_installed.with_version('1.10') } end describe selinux_module('bootloader') do