blob: 980626bd31f5ded0d0c9e29208a22bef65d5243c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
require 'spec_helper'
describe Contact do
let(:params) { create_contact_params }
it "rejects empty postcodes" do
params.delete('postcode')
@contact = Contact.new(params)
expect(@contact.valid?).to be(false)
end
it "rejects too short postcodes" do
params['postcode'] = '123'
@contact = Contact.new(params)
expect(@contact.valid?).to be(false)
end
it "rejects too long postcodes" do
params['postcode'] = '12345'
@contact = Contact.new(params)
expect(@contact.valid?).to be(false)
end
it "rejects postcodes wiht invalid chars" do
params['postcode'] = '123s'
@contact = Contact.new(params)
expect(@contact.valid?).to be(false)
end
end
|