Class: Easy::Matchers::BaseValidationMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/matchers/validations/base_validation_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes, type) ⇒ BaseValidationMatcher

Returns a new instance of BaseValidationMatcher.



11
12
13
14
15
16
17
# File 'lib/matchers/validations/base_validation_matcher.rb', line 11

def initialize(attributes, type)
  @attributes = attributes
  @failure_message = nil
  @failure_message_when_negated = nil
  @type = type
  @options = {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



4
5
6
# File 'lib/matchers/validations/base_validation_matcher.rb', line 4

def attributes
  @attributes
end

#failure_messageObject (readonly)

Returns the value of attribute failure_message.



4
5
6
# File 'lib/matchers/validations/base_validation_matcher.rb', line 4

def failure_message
  @failure_message
end

#failure_message_when_negatedObject (readonly)

Returns the value of attribute failure_message_when_negated.



4
5
6
# File 'lib/matchers/validations/base_validation_matcher.rb', line 4

def failure_message_when_negated
  @failure_message_when_negated
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/matchers/validations/base_validation_matcher.rb', line 4

def options
  @options
end

#subjectObject (readonly)

Returns the value of attribute subject.



4
5
6
# File 'lib/matchers/validations/base_validation_matcher.rb', line 4

def subject
  @subject
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/matchers/validations/base_validation_matcher.rb', line 4

def type
  @type
end

Instance Method Details

#allow_blankObject

Raises:

  • (NotImplementedError)


48
49
50
# File 'lib/matchers/validations/base_validation_matcher.rb', line 48

def allow_blank
  raise NotImplementedError, 'Subclasses must implement a allow_blank method.'
end

#allow_nilObject

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/matchers/validations/base_validation_matcher.rb', line 44

def allow_nil
  raise NotImplementedError, 'Subclasses must implement a allow_nil method.'
end

#class_nameObject



24
25
26
# File 'lib/matchers/validations/base_validation_matcher.rb', line 24

def class_name
  subject.class
end

#descriptionObject

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/matchers/validations/base_validation_matcher.rb', line 28

def description
  raise NotImplementedError, 'Subclasses must implement a description method.'
end

#ifObject

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/matchers/validations/base_validation_matcher.rb', line 32

def if
  raise NotImplementedError, 'Subclasses must implement a if method.'
end

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/matchers/validations/base_validation_matcher.rb', line 19

def matches?(subject)
  @subject = subject
  false
end

#on(context) ⇒ Object

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/matchers/validations/base_validation_matcher.rb', line 40

def on(context)
  raise NotImplementedError, 'Subclasses must implement a on method.'
end

#strictObject

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/matchers/validations/base_validation_matcher.rb', line 52

def strict
  raise NotImplementedError, 'Subclasses must implement a strict method.'
end

#unlessObject

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/matchers/validations/base_validation_matcher.rb', line 36

def unless
  raise NotImplementedError, 'Subclasses must implement a unless method.'
end