Sha256: db0b61cb1a86b3e3e27c33a4b781012f2955cd347a18e66ae9fd81752aadd0d1

Contents?: true

Size: 1010 Bytes

Versions: 4

Compression:

Stored size: 1010 Bytes

Contents

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

describe ActsAsIcontact::Message do
    
  it "defaults messageType to normal" do
    m = ActsAsIcontact::Message.new
    m.messageType.should == "normal"
  end
    
  it "requires messageType and subject" do
    m = ActsAsIcontact::Message.new(:messageType => nil)
    lambda{m.save}.should raise_error(ActsAsIcontact::ValidationError, "Missing required fields: messageType, subject")
  end
  
  it "must have an acceptable messageType" do
    m = ActsAsIcontact::Message.new(:messageType => "dummy", :subject => "test")
    lambda{m.save}.should raise_error(ActsAsIcontact::ValidationError, "messageType must be one of: normal, autoresponder, welcome, confirmation")
  end
  
  context "associations" do
    before(:each) do
      @message = ActsAsIcontact::Message.first(:subject => "Test Message")
    end
  
    it "knows which campaign it has (if any)" do
      @message.campaign.name.should == "Test Campaign"
    end 
  end
    
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
SFEley-acts_as_icontact-0.3.2 spec/resources/message_spec.rb
SFEley-acts_as_icontact-0.4.0 spec/resources/message_spec.rb
acts_as_icontact-0.4.0 spec/resources/message_spec.rb
acts_as_icontact-0.3.2 spec/resources/message_spec.rb