Sha256: 4a5fa389083ec1e3b7ea591f24f7db71bf4ed299edefc64bba46b601fb8ddfaa

Contents?: true

Size: 954 Bytes

Versions: 4

Compression:

Stored size: 954 Bytes

Contents

require 'dummy_spec_helper'

describe Carrier::Message do
  describe 'Carrier::Message class' do
    subject {Carrier::Message}
    its(:table_name) { should == Carrier.config.models.table_for(:message) }
     
    describe "#find_recipients" do
      it "should return all recipients" do
        pending
      end
    end
  end 
  
  [:chain, :sender_user].each do |as| 
    it { should belong_to(as) }
  end

  it "should serialize .recipients field" do
    subject.recipients.should == []
  end

  concern "Validations" do
    it "should not save messages with empty .content field" do
      lambda {
        subject.content = ''
        subject.save!
      }.should raise_error(ActiveRecord::RecordInvalid)
    end
    it "should not save messages with wrong recipients" do
      lambda {
        subject.sender = 1
        subject.content = 'something'
        subject.save!
      }.should raise_error(ActiveRecord::RecordInvalid)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
carrier-0.1.2 spec/carrier/app/models/message_spec.rb
carrier-0.1.1 spec/carrier/app/models/message_spec.rb
carrier-0.1.0 spec/carrier/app/models/message_spec.rb
carrier-0.0.6 spec/carrier/app/models/message_spec.rb