Sha256: e916dd00c8dc9a4decdfc0c61d591d0dcce07a03cba7da8a840eae1021f418cb

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

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

describe ActsAsIcontact::List do
  it "requires name, emailOwnerOnChange, welcomeOnManualAdd, welcomeOnSignupAdd, welcomeMessageId" do
    l = ActsAsIcontact::List.new
    lambda{l.save}.should raise_error(ActsAsIcontact::ValidationError, "Missing required fields: name, emailOwnerOnChange, welcomeOnManualAdd, welcomeOnSignupAdd, welcomeMessageId")
  end
  
  it "uses true and false to assign boolean fields" do
    l = ActsAsIcontact::List.new
    l.emailOwnerOnChange = true
    l.welcomeOnSignupAdd = false
    l.instance_variable_get(:@properties)["emailOwnerOnChange"].should == 1
    l.instance_variable_get(:@properties)["welcomeOnSignupAdd"].should == 0
  end

  it "uses true and false to retrieve boolean fields" do
    l = ActsAsIcontact::List.new
    l.instance_variable_set(:@properties,{"welcomeOnManualAdd" => 1, "emailOwnerOnChange" => 0})
    l.emailOwnerOnChange.should be_false
    l.welcomeOnManualAdd.should be_true
  end
  
  it "can find a list by name" do
    l = ActsAsIcontact::List.find("First Test")
    l.id.should == 444444
  end
  
  context "associations" do
    # Create one good list
    before(:each) do
      @list = ActsAsIcontact::List.first(:name => "First Test")
    end
    it "knows its subscribers"
    
    it "knows its welcome message" do
      @list.welcomeMessage.should == ActsAsIcontact::Message.find(555555)
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
SFEley-acts_as_icontact-0.2.1 spec/resources/list_spec.rb
acts_as_icontact-0.2.1 spec/resources/list_spec.rb