diff --git a/lib/chefspec/matchers/notifications_matcher.rb b/lib/chefspec/matchers/notifications_matcher.rb index 8b31eaff..593be8a9 100644 --- a/lib/chefspec/matchers/notifications_matcher.rb +++ b/lib/chefspec/matchers/notifications_matcher.rb @@ -3,9 +3,9 @@ class NotificationsMatcher include ChefSpec::Normalize def initialize(signature) - signature.match(/^([^\[]*)\[(.*)\]$/) - @expected_resource_type = $1 - @expected_resource_name = $2 + match = signature.match(/^([^\[]*)\[(.*)\]$/) + @expected_resource_type = match[1] + @expected_resource_name = match[2] end def matches?(resource) diff --git a/lib/chefspec/matchers/subscribes_matcher.rb b/lib/chefspec/matchers/subscribes_matcher.rb index df40333b..10d13b7f 100644 --- a/lib/chefspec/matchers/subscribes_matcher.rb +++ b/lib/chefspec/matchers/subscribes_matcher.rb @@ -3,9 +3,9 @@ class SubscribesMatcher include ChefSpec::Normalize def initialize(signature) - signature.match(/^([^\[]*)\[(.*)\]$/) - @expected_resource_type = $1 - @expected_resource_name = $2 + match = signature.match(/^([^\[]*)\[(.*)\]$/) + @expected_resource_type = match[1] + @expected_resource_name = match[2] end def matches?(resource)