Sha256: 9e0cf083bd12eb280223ca47b6d35a4be064fc91595edd312e7201539e143e5e

Contents?: true

Size: 1.37 KB

Versions: 16

Compression:

Stored size: 1.37 KB

Contents

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

describe ActsAsIcontact, "account_id" do
  it "returns the ID from the first client folder returned by iContact" do
    ActsAsIcontact.client_id.should == 222222
  end
  
  it "can be set by the user" do
    ActsAsIcontact.client_id = 456
    ActsAsIcontact.client_id.should == 456
  end
  
  after(:each) do
    ActsAsIcontact.client_id = nil
  end
end


describe ActsAsIcontact, "client method" do
  it "returns a RestClient resource" do
    ActsAsIcontact.client.should be_a_kind_of(RestClient::Resource)
  end
  
  it "builds upon the 'account' object" do
    ActsAsIcontact.expects(:account).returns(ActsAsIcontact.instance_variable_get(:@account))
    ActsAsIcontact.client.should_not be_nil
  end
  
  it "can be cleared with the reset_account! method" do
    ActsAsIcontact.reset_client!
    ActsAsIcontact.instance_variable_get(:@client).should be_nil
  end
  
  after(:each) do
    ActsAsIcontact.reset_client!
  end
end

describe ActsAsIcontact::Client do
  it "can return all clients for the given account" do
    ActsAsIcontact::Client.all.count.should == 1
  end
  
  it "can return the first client" do
    ActsAsIcontact::Client.first.should be_a_kind_of(ActsAsIcontact::Client)
  end
    
  it "knows its properties" do
    c = ActsAsIcontact::Client.first
    c.emailRecipient.should == "bob@example.org"
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
SFEley-acts_as_icontact-0.1.1 spec/resources/client_spec.rb
SFEley-acts_as_icontact-0.1.3 spec/resources/client_spec.rb
SFEley-acts_as_icontact-0.1.4 spec/resources/client_spec.rb
SFEley-acts_as_icontact-0.1.5 spec/resources/client_spec.rb
SFEley-acts_as_icontact-0.2.0 spec/resources/client_spec.rb
SFEley-acts_as_icontact-0.2.1 spec/resources/client_spec.rb
SFEley-acts_as_icontact-0.2.3 spec/resources/client_spec.rb
SFEley-acts_as_icontact-0.2.4 spec/resources/client_spec.rb
SFEley-acts_as_icontact-0.3.0 spec/resources/client_spec.rb
acts_as_icontact-0.1.1 spec/resources/client_spec.rb
acts_as_icontact-0.1.5 spec/resources/client_spec.rb
acts_as_icontact-0.2.0 spec/resources/client_spec.rb
acts_as_icontact-0.2.1 spec/resources/client_spec.rb
acts_as_icontact-0.2.3 spec/resources/client_spec.rb
acts_as_icontact-0.2.4 spec/resources/client_spec.rb
acts_as_icontact-0.3.0 spec/resources/client_spec.rb