Sha256: 561f9c2f8a3e088811549fd0558b44c67ce9f3edbab6f579a88bf576cdaab0eb

Contents?: true

Size: 996 Bytes

Versions: 6

Compression:

Stored size: 996 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Phone" do
  it "requires a type" do
    lambda {d = Etapper::Phone.new(:type => nil, :number => "404-777-8888")}.should raise_error(Etapper::BadValueError, "You must supply a valid type!")
  end
  
  it "requires a number" do
    lambda {d = Etapper::Phone.new(:type => :business)}.should raise_error(Etapper::BadValueError, "You must supply a phone number!")
  end
  
  it "can return a hash" do
    d = Etapper::Phone.new(:type => :business, :number => "404-777-8888")
    d.to_hash.should == {:business => "404-777-8888"}
  end
  
  it "can return its base" do
    d = Etapper::Phone.new(:type => :business, :number => "404-777-8888")
    d.base.should be_a(Etapper::API::Phone)
  end

  it "can be given an API::Phone type" do
    p = Etapper::API::Phone.new('123-456-7890','Mobile')
    d = Etapper::Phone.new(p)
    d.type.should == :mobile
    d.number.should == "123-456-7890"
    d.base.should === p
  end 
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
etapper-0.0.5 spec/phone_spec.rb
etapper-0.0.4 spec/phone_spec.rb
etapper-0.0.3 spec/phone_spec.rb
etapper-0.0.2 spec/phone_spec.rb
etapper-0.0.1 spec/phone_spec.rb
etapper-0.0.0 spec/phone_spec.rb