Module: Ubazu::Rspec::Matchers::ActiveRecord

Included in:
RSpec::Matchers
Defined in:
lib/ubazu/rspec/matchers/active_record.rb,
lib/ubazu/rspec/matchers/active_record/helpers.rb,
lib/ubazu/rspec/matchers/active_record/validation_matcher.rb,
lib/ubazu/rspec/matchers/active_record/validate_inclusion_of_matcher.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Helpers Classes: ValidateInclusionOfMatcher, ValidationMatcher

Instance Method Summary collapse

Instance Method Details

#validate_inclusion_of(attr) ⇒ Object

Ensures that the model field value is included in specified array.

Options:

  • with_message - value the test expects to find in errors.on(:attribute). Regexp or String. Defaults to the translation for :blank.

Examples:

it { should validate_inclusion_of(:name).in(:array) }
it { should validate_inclusion_of(:name).in(:array)
       with_message(/is not optional/) }


18
19
20
# File 'lib/ubazu/rspec/matchers/active_record/validate_inclusion_of_matcher.rb', line 18

def validate_inclusion_of(attr)
  ValidateInclusionOfMatcher.new(attr)
end