Class: Remarkable::ActiveRecord::Matchers::CallbackMatcher

Inherits:
Matcher::Base
  • Object
show all
Defined in:
lib/remarkable/active_record/macros/callbacks/callback_matcher.rb

Instance Method Summary collapse

Methods inherited from Matcher::Base

#failure_message, #negative, #negative_failure_message, #spec

Methods included from Matcher::DSL

included

Constructor Details

#initialize(callback, method) ⇒ CallbackMatcher



12
13
14
15
# File 'lib/remarkable/active_record/macros/callbacks/callback_matcher.rb', line 12

def initialize(callback, method)
  @callback = callback
  @method   = method
end

Instance Method Details

#descriptionObject



22
23
24
# File 'lib/remarkable/active_record/macros/callbacks/callback_matcher.rb', line 22

def description
  "have a #{@callback} callback named #{@method}"
end

#matches?(subject) ⇒ Boolean



17
18
19
20
# File 'lib/remarkable/active_record/macros/callbacks/callback_matcher.rb', line 17

def matches?(subject)
  @subject = subject
  assert_matcher { has_callback? }
end