Sha256: 1c7ae31e3454a78d3225f0200b81db733aca16e58a8742951fad6d6a217d4143

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe Mailboxer::Receipt do
  
  before do
    @entity1 = FactoryGirl.create(:user)
    @entity2 = FactoryGirl.create(:user)
    @mail1 = @entity1.send_message(@entity2,"Body","Subject")   
  end
  
  it "should belong to a message" do
    assert @mail1.notification
  end
  
  it "should belong to a conversation" do
    assert @mail1.conversation    
  end
  
  it "should be able to be marked as unread" do
    @mail1.is_read.should==true
    @mail1.mark_as_unread
    @mail1.is_read.should==false
  end
  
  it "should be able to be marked as read" do
    @mail1.is_read.should==true
    @mail1.mark_as_unread
    @mail1.mark_as_read
    @mail1.is_read.should==true    
  end

  it "should be able to be marked as deleted" do
    @mail1.deleted.should==false
    @mail1.mark_as_deleted
    @mail1.deleted.should==true
  end

  it "should be able to be marked as not deleted" do
    @mail1.deleted=true
    @mail1.mark_as_not_deleted
    @mail1.deleted.should==false
  end

  context "STI models" do
    before do
      @entity3 = FactoryGirl.create(:user)
      @entity4 = FactoryGirl.create(:user)
      @mail2 = @entity3.send_message(@entity4, "Body", "Subject")
    end
	
    it "should refer to the correct base class" do
      @mail2.receiver_type.should == @entity3.class.base_class.to_s
    end
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mailboxer-0.12.4 spec/models/receipt_spec.rb
mailboxer-0.12.3 spec/models/receipt_spec.rb
mailboxer-0.12.2 spec/models/receipt_spec.rb
mailboxer-0.12.1 spec/models/receipt_spec.rb
mailboxer-0.12.0 spec/models/receipt_spec.rb
mailboxer-0.12.0.rc2 spec/models/receipt_spec.rb
mailboxer-0.12.0.rc1 spec/models/receipt_spec.rb