Module: RSpec::BeValidWhenMatcher
- Defined in:
- lib/rspec/be_valid_when_matcher.rb
Overview
Container module for be_valid_when matcher definition and implementation.
Defined Under Namespace
Classes: BeValidWhen
Basic chaining collapse
-
#is(*args) ⇒ self
Used to set field ‘value` and optional custom failure `message`.
Presence collapse
-
#is_not_present ⇒ self
Used to setup matcher for checking ‘nil` value.
Type collapse
-
#is_array(value = [42]) ⇒ self
Setup matcher for checking array values.
-
#is_bigdecimal(value = 0.42E2) ⇒ self
Setup matcher for checking bigdecimal values.
-
#is_bignum(value = 42**13) ⇒ self
Setup matcher for checking bignum values.
-
#is_complex(value = 42+0i) ⇒ self
Setup matcher for checking complex values.
-
#is_fixnum(value = 42) ⇒ self
Setup matcher for checking fixnum values.
-
#is_float(value = 3.14) ⇒ self
Setup matcher for checking float values.
-
#is_hash(value = { value: 42 }) ⇒ self
Setup matcher for checking hash values.
-
#is_integer(value = 42) ⇒ self
Setup matcher for checking integer values.
-
#is_numeric(value = 42) ⇒ self
Setup matcher for checking numeric values.
-
#is_rational(value = 42/1) ⇒ self
Setup matcher for checking rational values.
-
#is_regexp(value = /^value$/) ⇒ self
Setup matcher for checking regexp values.
-
#is_string(value = 'value') ⇒ self
Setup matcher for checking string values.
-
#is_symbol(value = :value) ⇒ self
Setup matcher for checking symbol values.
Logical value collapse
-
#is_false ⇒ self
Check validity of field with ‘FalseClass` value.
-
#is_true ⇒ self
Check validity of field with ‘TrueClass` value.
Instance Method Summary collapse
-
#be_valid_when(*args) ⇒ self
Model validity assertion.
Instance Method Details
#be_valid_when(field) ⇒ self #be_valid_when(field, value) ⇒ self #be_valid_when(field, value, message) ⇒ self
Model validity assertion.
199 200 201 202 203 204 205 206 207 208 |
# File 'lib/rspec/be_valid_when_matcher.rb', line 199 def be_valid_when(*args) number_of_arguments = args.size field_name = args.shift if number_of_arguments == 1 BeValidWhen.new(field_name) else BeValidWhen.new(field_name).is(*args) end end |
#is(value) ⇒ self #is(value, message) ⇒ self
Used to set field ‘value` and optional custom failure `message`.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 212
|
#is_array(value = [42]) ⇒ self
Setup matcher for checking array values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 316
|
#is_bigdecimal(value = 0.42E2) ⇒ self
Setup matcher for checking bigdecimal values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 295
|
#is_bignum(value = 42**13) ⇒ self
Setup matcher for checking bignum values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 267
|
#is_complex(value = 42+0i) ⇒ self
Setup matcher for checking complex values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 281
|
#is_false ⇒ self
Check validity of field with ‘FalseClass` value.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 347
|
#is_fixnum(value = 42) ⇒ self
Setup matcher for checking fixnum values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 260
|
#is_float(value = 3.14) ⇒ self
Setup matcher for checking float values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 274
|
#is_hash(value = { value: 42 }) ⇒ self
Setup matcher for checking hash values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 323
|
#is_integer(value = 42) ⇒ self
Setup matcher for checking integer values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 253
|
#is_not_present ⇒ self
Used to setup matcher for checking ‘nil` value.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 236
|
#is_numeric(value = 42) ⇒ self
Setup matcher for checking numeric values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 246
|
#is_rational(value = 42/1) ⇒ self
Setup matcher for checking rational values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 288
|
#is_regexp(value = /^value$/) ⇒ self
Setup matcher for checking regexp values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 309
|
#is_string(value = 'value') ⇒ self
Setup matcher for checking string values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 302
|
#is_symbol(value = :value) ⇒ self
Setup matcher for checking symbol values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 330
|
#is_true ⇒ self
Check validity of field with ‘TrueClass` value.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 341
|