Class: Ubazu::Rspec::Matchers::ActiveRecord::ValidateInclusionOfMatcher
- Inherits:
-
ValidationMatcher
- Object
- ValidationMatcher
- Ubazu::Rspec::Matchers::ActiveRecord::ValidateInclusionOfMatcher
show all
- Defined in:
- lib/ubazu/rspec/matchers/active_record/validate_inclusion_of_matcher.rb
Overview
Instance Attribute Summary
#failure_message
Instance Method Summary
collapse
#initialize, #negative_failure_message
Instance Method Details
#description ⇒ Object
42
43
44
|
# File 'lib/ubazu/rspec/matchers/active_record/validate_inclusion_of_matcher.rb', line 42
def description
"ensured inclusion of #{@attribute} in #{@array.inspect}"
end
|
#in(array) ⇒ Object
24
25
26
27
|
# File 'lib/ubazu/rspec/matchers/active_record/validate_inclusion_of_matcher.rb', line 24
def in(array)
@array = array
self
end
|
#matches?(instance) ⇒ Boolean
34
35
36
37
38
39
40
|
# File 'lib/ubazu/rspec/matchers/active_record/validate_inclusion_of_matcher.rb', line 34
def matches?(instance)
@instance = instance
super(instance)
@expected_message ||= :blank
!@instance.valid? and @instance.errors.include? @expected_message
end
|
#with_message(message) ⇒ Object
29
30
31
32
|
# File 'lib/ubazu/rspec/matchers/active_record/validate_inclusion_of_matcher.rb', line 29
def with_message(message)
@expected_message = message if message
self
end
|