-
Notifications
You must be signed in to change notification settings - Fork 682
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
Matcher : be_in #2018
Labels
Type: Enhancement
Improves an existing feature
Comments
rx294
added a commit
to aaronlippold/inspec
that referenced
this issue
Jul 18, 2017
Fixes inspec#2018 Signed-off-by: Rony Xavier <rx294@nyu.edu>
Love the direction of this @rx294 !! :) |
Thank you @arlimus, hope you guys can decide on the matcher's name soon...unless it can remain 'be_in' :) |
rx294
added a commit
to aaronlippold/inspec
that referenced
this issue
Jul 20, 2017
describe nginx do its(module_list) { should be_in AUTHORIZED_MODULE_LIST } end Fixes inspec#2018 Signed-off-by: Rony Xavier <rx294@nyu.edu>
rx294
added a commit
to aaronlippold/inspec
that referenced
this issue
Jul 22, 2017
Fixes inspec#2018 Signed-off-by: Rony Xavier <rx294@nyu.edu>
chris-rock
pushed a commit
that referenced
this issue
Aug 7, 2017
* New matcher 'be_in' Fixes #2018 Signed-off-by: Rony Xavier <rx294@nyu.edu> * small fixes to wording. Signed-off-by: Aaron Lippold <lippold@gmail.com> * Added code to use be_in for with the following use case: describe nginx do its(module_list) { should be_in AUTHORIZED_MODULE_LIST } end Fixes #2018 Signed-off-by: Rony Xavier <rx294@nyu.edu> * Updates to the matcher Fixes #2018 Signed-off-by: Rony Xavier <rx294@nyu.edu> * Added tests for the be_in matcher Signed-off-by: Rony Xavier <rx294@nyu.edu> * Requested updates completed Signed-off-by: Rony Xavier <rx294@nyu.edu>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
It will be very very useful to have a matcher that serves the following use case
describe nginx do
its('user') { should be_in AUTHORIZED_USER_LIST }
end
describe nginx do
its('module') { should_not be_in VULNURABLE_MODULE_LIST }
end
describe nginx do
its('user') { should_not be_in UNAUTHORIZED_USER_LIST }
end
Possible Solutions
The following code in matches.rb does the job
RSpec::Matchers.define :be_in do |list|
match do |item|
list.include?(item)
end
failure_message do |item|
"expected that
#{item}
to be in#{list}
"end
end
The text was updated successfully, but these errors were encountered: