Class: Remarkable::ActiveRecord::Matchers::EnsureValueInListMatcher
- Inherits:
-
Matcher::Base
- Object
- Matcher::Base
- Remarkable::ActiveRecord::Matchers::EnsureValueInListMatcher
show all
- Includes:
- Helpers
- Defined in:
- lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb
Instance Method Summary
collapse
Methods included from Helpers
#allow_blank, #allow_nil, #message
#assert_contains, #assert_does_not_contain
#negative, #spec
included, #matches?
Instance Method Details
#description ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb', line 12
def description
values = @good_values.dup
values << 'nil' if @options[:allow_nil]
values << 'blank' if @options[:allow_blank]
if @behavior == :invalid
"allow #{@attribute} to be set to #{values.to_sentence}"
else
"ensure #{@behavior} of #{values.to_sentence} in #{@attribute}"
end
end
|
#failure_message ⇒ Object
24
25
26
|
# File 'lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb', line 24
def failure_message
"Expected to #{expectation} (#{@missing})"
end
|
#negative_failure_message ⇒ Object
28
29
30
|
# File 'lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb', line 28
def negative_failure_message
"Did not expect to #{expectation}"
end
|