51 lines
1.2 KiB
Ruby
51 lines
1.2 KiB
Ruby
|
require 'spec_helper'
|
||
|
require 'avm/contact'
|
||
|
|
||
|
describe AVM::Contact do
|
||
|
let(:contact) { AVM::Contact.new(contact_info) }
|
||
|
|
||
|
subject { contact }
|
||
|
|
||
|
let(:contact_info) { {
|
||
|
:name => name,
|
||
|
:email => email,
|
||
|
:telephone => telephone,
|
||
|
:address => address,
|
||
|
:city => city,
|
||
|
:state => state,
|
||
|
:postal_code => postal_code,
|
||
|
:country => country
|
||
|
} }
|
||
|
|
||
|
let(:name) { 'John Bintz' }
|
||
|
let(:email) { 'bintz@stsci.edu' }
|
||
|
let(:telephone) { '800-555-1234' }
|
||
|
let(:address) { '3700 San Martin Drive' }
|
||
|
let(:city) { 'Baltimore' }
|
||
|
let(:state) { 'Maryland' }
|
||
|
let(:postal_code) { '21218' }
|
||
|
let(:country) { 'USA' }
|
||
|
|
||
|
its(:name) { should == name }
|
||
|
its(:email) { should == email }
|
||
|
its(:telephone) { should == telephone }
|
||
|
its(:address) { should == address }
|
||
|
its(:city) { should == city }
|
||
|
its(:state) { should == state }
|
||
|
its(:province) { should == state }
|
||
|
its(:postal_code) { should == postal_code }
|
||
|
its(:zip) { should == postal_code }
|
||
|
its(:country) { should == country }
|
||
|
|
||
|
describe 'mappings' do
|
||
|
AVM::Contact::FIELD_MAP.each do |key, value|
|
||
|
context "#{key} => #{value}" do
|
||
|
let(:contact_info) { { key => "test" } }
|
||
|
|
||
|
its(value) { should == "test" }
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|