Class: Remarkable::ActiveRecord::Matchers::HaveClassMethods

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

Instance Method Summary collapse

Methods inherited from Matcher::Base

#negative, #spec

Methods included from Matcher::DSL

included

Constructor Details

#initialize(*methods) ⇒ HaveClassMethods



5
6
7
8
# File 'lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb', line 5

def initialize(*methods)
  methods.extract_options!
  @methods = methods
end

Instance Method Details

#descriptionObject



19
20
21
# File 'lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb', line 19

def description
  "respond to class method #{@methods.to_sentence}"
end

#failure_messageObject



23
24
25
# File 'lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb', line 23

def failure_message
  "Expected #{expectation} (#{@missing})"
end

#matches?(subject) ⇒ Boolean



10
11
12
13
14
15
16
17
# File 'lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb', line 10

def matches?(subject)
  @subject = subject

  assert_matcher_for(@methods) do |method|
    @method = method
    have_class_method?
  end
end

#negative_failure_messageObject



27
28
29
# File 'lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb', line 27

def negative_failure_message
  "Did not expect #{expectation}"
end