forked from mislav/contacts
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API change: #contacts method no longer returns nested arrays, but an …
…array of Contacts::Contact instances
- Loading branch information
Showing
7 changed files
with
81 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters