spec/support/matchers/add_method.rb in azeroth-0.0.4 vs spec/support/matchers/add_method.rb in azeroth-0.0.5
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module RSpec
module CustomMatchers
class AddMethod < Matchers::BuiltIn::BaseMatcher
attr_reader :method
@@ -31,10 +33,11 @@
end
def matches?(event_proc)
@event_proc = event_proc
return false unless event_proc.is_a?(Proc)
+
raise_block_syntax_error if block_given?
perform_change(event_proc)
changed?
end
@@ -62,11 +65,12 @@
def instance_class
@instance_class ||= evaluated_instance.class
end
def raise_block_syntax_error
- raise SyntaxError, 'Block not received by the `add_method_to` matcher. ' \
- 'Perhaps you want to use `{ ... }` instead of do/end?'
+ raise SyntaxError, 'Block not received by the' \
+ '`add_method_to` matcher. ' \
+ 'Perhaps you want to use `{ ... }` instead of do/end?'
end
end
end
end