Skip to content

Commit

Permalink
Fix be_installed matcher when used with expect
Browse files Browse the repository at this point in the history
When used like

  expect(package('httpd')).to be_installed

it causes an error that subject is not defined

  undefined local variable or method `subject' for
  #<RSpec::Matchers::DSL::Matcher be_installed> (NameError)

It should be changed to use the passed #match parameter 'name'
instead of 'subject'.
  • Loading branch information
Markus Benning committed Nov 6, 2017
1 parent 1cbc575 commit b59b99f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/serverspec/matcher/be_installed.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RSpec::Matchers.define :be_installed do
match do |name|
if subject.class.name == 'Serverspec::Type::SelinuxModule'
if name.class.name == 'Serverspec::Type::SelinuxModule'
name.installed?(@version)
else
name.installed?(@provider, @version)
Expand Down

0 comments on commit b59b99f

Please sign in to comment.