class ChefSpec::Matchers::SubscribesMatcher
Public Class Methods
new(signature)
click to toggle source
# File lib/chefspec/matchers/subscribes_matcher.rb, line 5 def initialize(signature) signature.match(/^([^\[]*)\[(.*)\]$/) @expected_resource_type = $1 @expected_resource_name = $2 end
Public Instance Methods
before()
click to toggle source
# File lib/chefspec/matchers/subscribes_matcher.rb, line 55 def before @before = true self end
delayed()
click to toggle source
# File lib/chefspec/matchers/subscribes_matcher.rb, line 50 def delayed @delayed = true self end
description()
click to toggle source
# File lib/chefspec/matchers/subscribes_matcher.rb, line 60 def description @instance.description end
failure_message()
click to toggle source
# File lib/chefspec/matchers/subscribes_matcher.rb, line 64 def failure_message @instance.failure_message end
failure_message_when_negated()
click to toggle source
# File lib/chefspec/matchers/subscribes_matcher.rb, line 68 def failure_message_when_negated @instance.failure_message_when_negated end
immediately()
click to toggle source
# File lib/chefspec/matchers/subscribes_matcher.rb, line 45 def immediately @immediately = true self end
matches?(resource)
click to toggle source
# File lib/chefspec/matchers/subscribes_matcher.rb, line 11 def matches?(resource) @instance = ChefSpec::Matchers::NotificationsMatcher.new(resource.to_s) if @action @instance.to(@action) end if @immediately @instance.immediately end if @delayed @instance.delayed end if @before @instance.before end if resource runner = resource.run_context.node.runner expected = runner.find_resource(@expected_resource_type, @expected_resource_name) @instance.matches?(expected) else @instance.matches?(nil) end end
on(action)
click to toggle source
# File lib/chefspec/matchers/subscribes_matcher.rb, line 40 def on(action) @action = action self end