Sha256: 72c0e94803fc0c094b06cbd0e022806726ffc3c6ea172e3a910c256a22ec2089

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Highrise::Person do
  subject { Highrise::Person.new(:id => 1) }
  
  it { should be_a_kind_of Highrise::Subject }

  it_should_behave_like "a paginated class"
  it_should_behave_like "a taggable class"
  it_should_behave_like "a searchable class"

  it ".find_all_across_pages_since" do
    mocked_now = Time.parse("Wed Jan 14 15:43:11 -0200 2009")
    Highrise::Person.should_receive(:find_all_across_pages).with({:params=>{:since=>"20090114174311"}}).and_return("result")
    Highrise::Person.find_all_across_pages_since(mocked_now).should == "result"
  end
  
  describe "#company" do
    it "returns nil when it doesn't have a company" do
      subject.should_receive(:company_id).and_return(nil)
      subject.company.should be_nil
    end

    it "delegate to Highrise::Company when have company_id" do
      subject.should_receive(:company_id).at_least(2).times.and_return(1)
      Highrise::Company.should_receive(:find).with(1).and_return("company")
      subject.company.should == "company"
    end
  end
  
  it "#name" do
    subject.should_receive(:first_name).and_return("Marcos")
    subject.should_receive(:last_name).and_return("Tapajós     ")
    subject.name.should == "Marcos Tapajós"
  end
  
  it { subject.label.should == 'Party' }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
highrise-3.0.0 spec/highrise/person_spec.rb