Sha256: cc7c9a35da3afdb4487e3b1b18224159cec152c89df725159da2d74dfb3ba45f

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

describe 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.message
  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

2 entries across 2 versions & 1 rubygems

Version Path
mailboxer-without-notification-0.11.2 spec/models/receipt_spec.rb
mailboxer-without-notification-0.11.1 spec/models/receipt_spec.rb