Class: Matchers::AutoRequireMatcher
- Defined in:
- vendor_modules/lvm/spec/lib/matchers.rb
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(*expected) ⇒ AutoRequireMatcher
constructor
A new instance of AutoRequireMatcher.
- #matches?(resource) ⇒ Boolean
Constructor Details
#initialize(*expected) ⇒ AutoRequireMatcher
Returns a new instance of AutoRequireMatcher.
4 5 6 |
# File 'vendor_modules/lvm/spec/lib/matchers.rb', line 4 def initialize(*expected) @expected = expected end |
Instance Method Details
#failure_message_for_should ⇒ Object
16 17 18 |
# File 'vendor_modules/lvm/spec/lib/matchers.rb', line 16 def "expected resource autorequires (#{@autorequires.inspect}) to include #{@expected.inspect}" end |
#failure_message_for_should_not ⇒ Object
19 20 21 |
# File 'vendor_modules/lvm/spec/lib/matchers.rb', line 19 def "expected resource autorequires (#{@autorequires.inspect}) to not include #{@expected.inspect}" end |
#matches?(resource) ⇒ Boolean
8 9 10 11 12 13 14 15 |
# File 'vendor_modules/lvm/spec/lib/matchers.rb', line 8 def matches?(resource) resource_type = resource.class configuration = resource_type.instance_variable_get(:@autorequires) || {} @autorequires = configuration.inject([]) do |memo, (param, block)| memo + resource.instance_eval(&block) end @autorequires.include?(@expected) end |