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

Instance Method Summary collapse

Instance Method Details

#be_valid_when(*args) ⇒ void

Model validity assertion.


181
182
183
184
185
186
187
188
189
190
# File 'lib/rspec/be_valid_when_matcher.rb', line 181

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