Extract mismatch validator to separate class

#569
This commit is contained in:
Artur Beljajev 2017-09-12 14:55:41 +03:00
parent 4d5830efdf
commit d5197962ee
5 changed files with 40 additions and 28 deletions

View file

@ -129,8 +129,8 @@ RSpec.describe Contact::Ident, db: false do
let(:ident) { described_class.new(type: 'test', country_code: 'DE') }
before do
mismatches = [Contact::Ident::Mismatch.new('test', Country.new('DE'))]
allow(described_class).to receive(:mismatches).and_return(mismatches)
mismatches = [Contact::Ident::MismatchValidator::Mismatch.new('test', Country.new('DE'))]
allow(Contact::Ident::MismatchValidator).to receive(:mismatches).and_return(mismatches)
end
it 'rejects mismatched' do
@ -161,16 +161,6 @@ RSpec.describe Contact::Ident, db: false do
end
end
describe '::mismatches' do
it 'returns mismatches' do
mismatches = [
Contact::Ident::Mismatch.new('birthday', Country.new('EE'))
]
expect(described_class.mismatches).to eq(mismatches)
end
end
describe '#birthday?' do
context 'when type is birthday' do
subject(:ident) { described_class.new(type: 'birthday') }