Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix be_installed matcher when used with expect #598

Merged
merged 2 commits into from
Nov 7, 2017

Conversation

benningm
Copy link

@benningm benningm commented Nov 6, 2017

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'.

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'.
@@ -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'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR. Could you change match do |name| to match do |subject| instead of this line , please?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And please rewrite other name to subject.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit started mixing name and subject:

12b917b

Before it was called name. So I changed it to 'name'.

Of course we can also rename it to subject. I'll add another commit.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

As discussed in mizzy#598 we change the parameter name from

  match do |name|

to

  match do |subject|
@mizzy mizzy merged commit 784da44 into mizzy:master Nov 7, 2017
@mizzy
Copy link
Owner

mizzy commented Nov 7, 2017

Released as v2.41.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants