Module: RSpec::AnyOf
- Defined in:
- lib/rspec/any_of.rb,
lib/rspec/any_of/version.rb
Overview
Provides argument matchers accepting a list of allowed arguments.
Constant Summary collapse
- VERSION =
'1.0.0'.freeze
Instance Method Summary collapse
-
#all_of(*required_arguments) ⇒ Object
Strict argument inclusion matcher.
-
#any_of(*allowed_arguments) ⇒ Object
Liberal argument inclusion matcher.
Instance Method Details
#all_of(*required_arguments) ⇒ Object
Strict argument inclusion matcher. Should be used with countable qualifier.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rspec/any_of.rb', line 35 RSpec::Matchers.define :all_of do |*expected| description do "all of #{expected}" end match do |actual| @expected ||= expected.dup expect(@expected.delete(actual)).not_to be_nil end end |
#any_of(*allowed_arguments) ⇒ Object
Liberal argument inclusion matcher.
15 16 17 18 19 20 21 22 23 |
# File 'lib/rspec/any_of.rb', line 15 RSpec::Matchers.define :any_of do |*expected| description do "any of #{expected}" end match do |actual| expected.include?(actual) end end |