/
contact_spec.rb
38 lines (31 loc) · 989 Bytes
/
contact_spec.rb
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
30
31
32
33
34
35
36
37
38
require 'spec_helper'
require 'contacts'
describe Contacts::Contact do
describe 'instance' do
before do
@contact = Contacts::Contact.new('max@example.com', 'Max Power', 'maxpower')
end
it "should have email" do
@contact.email.should == 'max@example.com'
end
it "should have name" do
@contact.name.should == 'Max Power'
end
it "should support multiple emails" do
@contact.emails << 'maxpower@example.com'
@contact.email.should == 'max@example.com'
@contact.emails.should == ['max@example.com', 'maxpower@example.com']
end
it "should have username" do
@contact.username.should == 'maxpower'
end
it "should have nice inspect" do
@contact.inspect.should == '#<Contacts::Contact "Max Power" (max@example.com)>'
end
end
it "should fail without first argument (email)" do
lambda {
Contacts::Contact.new()
}.should raise_error(ArgumentError)
end
end