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
valueand optional custom failuremessage.
Presence collapse
-
#is_not_present ⇒ self
Used to setup matcher for checking
nilvalue.
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.
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.
189 190 191 192 193 194 195 196 197 198 |
# File 'lib/rspec/be_valid_when_matcher.rb', line 189 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 202
|
#is_array(value = [42]) ⇒ self
Setup matcher for checking array values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 306
|
#is_bigdecimal(value = 0.42E2) ⇒ self
Setup matcher for checking bigdecimal values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 285
|
#is_bignum(value = 42**13) ⇒ self
Setup matcher for checking bignum values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 257
|
#is_complex(value = 42+0i) ⇒ self
Setup matcher for checking complex values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 271
|
#is_fixnum(value = 42) ⇒ self
Setup matcher for checking fixnum values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 250
|
#is_float(value = 3.14) ⇒ self
Setup matcher for checking float values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 264
|
#is_hash(value = { value: 42 }) ⇒ self
Setup matcher for checking hash values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 313
|
#is_integer(value = 42) ⇒ self
Setup matcher for checking integer values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 243
|
#is_not_present ⇒ self
Used to setup matcher for checking nil value.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 226
|
#is_numeric(value = 42) ⇒ self
Setup matcher for checking numeric values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 236
|
#is_rational(value = 42/1) ⇒ self
Setup matcher for checking rational values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 278
|
#is_regexp(value = /^value$/) ⇒ self
Setup matcher for checking regexp values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 299
|
#is_string(value = 'value') ⇒ self
Setup matcher for checking string values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 292
|
#is_symbol(value = :value) ⇒ self
Setup matcher for checking symbol values.
|
|
# File 'lib/rspec/be_valid_when_matcher.rb', line 320
|