Sha256: ce761e0c5a9e7b792f449e12eba4da0e694c74904116914fef583016d897d690
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
require 'spec_helper' require 'factories/profiles.rb' describe MembershipNumberFormatValidator do let(:subject) { MembershipNumberFormatValidator } let( :attribute ) { :membership_number } let (:object) { Profile.new } context 'Wrong membership number format' do context 'No message is sent on the options' do it 'it returns error message expecified on the validator' do n = subject.new( { attributes: attribute } ) expect(n.validate_each(object, attribute, '6202721111')).to include('must be a valid membership number') end end context 'Message is sent on the options' do it 'it returns error message expecified on the options' do n = subject.new( { message: 'Test error message', attributes: :postal_code } ) expect(n.validate_each(object, attribute, '6202721111')).to include('Test error message') end end end context 'Correct membership number format' do context 'No message is sent on the options' do it 'it do not return error message' do n = subject.new( { attributes: attribute } ) expect(n.validate_each(object, attribute, '6202720022820001')).to equal(nil) end end context 'Message is sent on the options' do it 'it do not return error message' do n = subject.new( { message: 'Test error message', attributes: attribute } ) expect(n.validate_each(object, attribute, '6202720022820001')).to equal(nil) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ama_validators-0.0.1 | spec/membership_number_format_validator_spec.rb |