mailboxer 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/models/conversation.rb +1 -1
- data/app/models/mailbox.rb +8 -6
- data/app/models/notification.rb +4 -4
- data/app/models/receipt.rb +2 -2
- data/mailboxer.gemspec +1 -1
- data/spec/integration/message_and_receipt_spec.rb +28 -28
- data/spec/models/mailbox_spec.rb +16 -16
- metadata +4 -4
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.2. | 
| 1 | 
            +
            0.2.1
         | 
    
        data/app/models/conversation.rb
    CHANGED
    
    | @@ -87,7 +87,7 @@ class Conversation < ActiveRecord::Base | |
| 87 87 |  | 
| 88 88 | 
             
              #Returns the receipts of the conversation for one participants
         | 
| 89 89 | 
             
            	def receipts_for(participant)
         | 
| 90 | 
            -
            	  return Receipt.conversation(self). | 
| 90 | 
            +
            	  return Receipt.conversation(self).recipient(participant)
         | 
| 91 91 | 
             
            	end
         | 
| 92 92 |  | 
| 93 93 | 
             
              #Returns the number of messages of the conversation
         | 
    
        data/app/models/mailbox.rb
    CHANGED
    
    | @@ -9,7 +9,7 @@ class Mailbox | |
| 9 9 | 
             
              #Returns the notifications for the messageable
         | 
| 10 10 | 
             
              def notifications(options = {})
         | 
| 11 11 | 
             
                #:type => nil is a hack not to give Messages as Notifications
         | 
| 12 | 
            -
                return Notification. | 
| 12 | 
            +
                return Notification.recipient(@messageable).where(:type => nil) 
         | 
| 13 13 | 
             
              end
         | 
| 14 14 |  | 
| 15 15 | 
             
              #Returns the conversations for the messageable
         | 
| @@ -71,7 +71,7 @@ class Mailbox | |
| 71 71 |  | 
| 72 72 | 
             
              #Returns all the receipts of messageable, from Messages and Notifications
         | 
| 73 73 | 
             
              def receipts(options = {})
         | 
| 74 | 
            -
                return Receipt.where(options). | 
| 74 | 
            +
                return Receipt.where(options).recipient(@messageable)
         | 
| 75 75 | 
             
              end
         | 
| 76 76 |  | 
| 77 77 | 
             
              #Deletes all the messages in the trash of messageable. NOT IMPLEMENTED.
         | 
| @@ -95,20 +95,22 @@ class Mailbox | |
| 95 95 | 
             
                return conversation.is_completely_trashed?(@messageable)
         | 
| 96 96 | 
             
              end
         | 
| 97 97 |  | 
| 98 | 
            -
              #Returns the receipts of object for messageable
         | 
| 98 | 
            +
              #Returns the receipts of object for messageable as a ActiveRecord::Relation
         | 
| 99 99 | 
             
              #
         | 
| 100 100 | 
             
              #Object can be:
         | 
| 101 101 | 
             
              #* A Message
         | 
| 102 102 | 
             
              #* A Notification
         | 
| 103 103 | 
             
              #* A Conversation
         | 
| 104 | 
            +
              #
         | 
| 105 | 
            +
              #If object isn't one of the above, a nil will be returned
         | 
| 104 106 | 
             
              def receipts_for(object)
         | 
| 105 107 | 
             
                case object
         | 
| 106 | 
            -
                when Message,Notification
         | 
| 107 | 
            -
                  return  | 
| 108 | 
            +
                when Message, Notification
         | 
| 109 | 
            +
                  return object.receipt_for(@messageable)
         | 
| 108 110 | 
             
                when Conversation
         | 
| 109 111 | 
             
                  return object.receipts_for(@messageable)
         | 
| 110 112 | 
             
                else
         | 
| 111 | 
            -
                return  | 
| 113 | 
            +
                return nil
         | 
| 112 114 | 
             
                end
         | 
| 113 115 | 
             
              end
         | 
| 114 116 |  | 
    
        data/app/models/notification.rb
    CHANGED
    
    | @@ -6,8 +6,8 @@ class Notification < ActiveRecord::Base | |
| 6 6 | 
             
              validates_presence_of :subject, :body
         | 
| 7 7 | 
             
              has_many :receipts
         | 
| 8 8 |  | 
| 9 | 
            -
              scope : | 
| 10 | 
            -
                joins(:receipts).where('receipts.receiver_id' =>  | 
| 9 | 
            +
              scope :recipient, lambda { |recipient|
         | 
| 10 | 
            +
                joins(:receipts).where('receipts.receiver_id' => recipient.id,'receipts.receiver_type' => recipient.class.to_s)
         | 
| 11 11 | 
             
              }
         | 
| 12 12 |  | 
| 13 13 | 
             
              class << self
         | 
| @@ -60,13 +60,13 @@ class Notification < ActiveRecord::Base | |
| 60 60 |  | 
| 61 61 | 
             
              #Returns the receipt for the participant
         | 
| 62 62 | 
             
              def receipt_for(participant)
         | 
| 63 | 
            -
                return Receipt.notification(self). | 
| 63 | 
            +
                return Receipt.notification(self).recipient(participant)
         | 
| 64 64 | 
             
              end
         | 
| 65 65 |  | 
| 66 66 | 
             
              #Returns if the participant have read the Notification
         | 
| 67 67 | 
             
              def is_unread?(participant)
         | 
| 68 68 | 
             
                return false if participant.nil?
         | 
| 69 | 
            -
                return self.receipt_for(participant). | 
| 69 | 
            +
                return self.receipt_for(participant).first.read
         | 
| 70 70 | 
             
              end
         | 
| 71 71 |  | 
| 72 72 | 
             
              include ActionView::Helpers::SanitizeHelper
         | 
    
        data/app/models/receipt.rb
    CHANGED
    
    | @@ -5,8 +5,8 @@ class Receipt < ActiveRecord::Base | |
| 5 5 |  | 
| 6 6 | 
             
              validates_presence_of :receiver
         | 
| 7 7 |  | 
| 8 | 
            -
              scope : | 
| 9 | 
            -
                where(:receiver_id =>  | 
| 8 | 
            +
              scope :recipient, lambda { |recipient|
         | 
| 9 | 
            +
                where(:receiver_id => recipient.id,:receiver_type => recipient.class.to_s)
         | 
| 10 10 | 
             
              }
         | 
| 11 11 | 
             
              #Notifications Scope checks type to be nil, not Notification because of STI behaviour
         | 
| 12 12 | 
             
              #with the primary class (no type is saved)
         | 
    
        data/mailboxer.gemspec
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            Gem::Specification.new do |s|
         | 
| 2 2 | 
             
            	s.name = "mailboxer"
         | 
| 3 | 
            -
            	s.version = "0.2. | 
| 3 | 
            +
            	s.version = "0.2.1"
         | 
| 4 4 | 
             
            	s.authors = ["Eduardo Casanova Cuesta"]
         | 
| 5 5 | 
             
            	s.summary = "Messaging system for rails apps."
         | 
| 6 6 | 
             
            	s.description = "A Rails engine that allows any model to act as messageable, permitting it interchange messages with any other messageable model." +  
         | 
| @@ -24,7 +24,7 @@ describe "Messages And Receipts" do | |
| 24 24 |  | 
| 25 25 | 
             
                  it "should create proper mails" do
         | 
| 26 26 | 
             
                    #Sender Mail
         | 
| 27 | 
            -
                    mail = Receipt. | 
| 27 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message1).first
         | 
| 28 28 | 
             
                    assert mail
         | 
| 29 29 | 
             
                    if mail
         | 
| 30 30 | 
             
                      mail.read.should==true
         | 
| @@ -32,7 +32,7 @@ describe "Messages And Receipts" do | |
| 32 32 | 
             
                      mail.mailbox_type.should=="sentbox"
         | 
| 33 33 | 
             
                    end      
         | 
| 34 34 | 
             
                    #Receiver Mail
         | 
| 35 | 
            -
                    mail = Receipt. | 
| 35 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message1).first
         | 
| 36 36 | 
             
                    assert mail
         | 
| 37 37 | 
             
                    if mail
         | 
| 38 38 | 
             
                      mail.read.should==false
         | 
| @@ -67,7 +67,7 @@ describe "Messages And Receipts" do | |
| 67 67 |  | 
| 68 68 | 
             
                  it "should create proper mails" do
         | 
| 69 69 | 
             
                    #Sender Mail
         | 
| 70 | 
            -
                    mail = Receipt. | 
| 70 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message2).first
         | 
| 71 71 | 
             
                    assert mail
         | 
| 72 72 | 
             
                    if mail
         | 
| 73 73 | 
             
                      mail.read.should==true
         | 
| @@ -75,7 +75,7 @@ describe "Messages And Receipts" do | |
| 75 75 | 
             
                      mail.mailbox_type.should=="sentbox"
         | 
| 76 76 | 
             
                    end      
         | 
| 77 77 | 
             
                    #Receiver Mail
         | 
| 78 | 
            -
                    mail = Receipt. | 
| 78 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message2).first
         | 
| 79 79 | 
             
                    assert mail
         | 
| 80 80 | 
             
                    if mail
         | 
| 81 81 | 
             
                      mail.read.should==false
         | 
| @@ -113,7 +113,7 @@ describe "Messages And Receipts" do | |
| 113 113 |  | 
| 114 114 | 
             
                  it "should create proper mails" do
         | 
| 115 115 | 
             
                    #Sender Mail
         | 
| 116 | 
            -
                    mail = Receipt. | 
| 116 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message2).first
         | 
| 117 117 | 
             
                    assert mail
         | 
| 118 118 | 
             
                    if mail
         | 
| 119 119 | 
             
                      mail.read.should==true
         | 
| @@ -121,7 +121,7 @@ describe "Messages And Receipts" do | |
| 121 121 | 
             
                      mail.mailbox_type.should=="sentbox"
         | 
| 122 122 | 
             
                    end      
         | 
| 123 123 | 
             
                    #Receiver Mail
         | 
| 124 | 
            -
                    mail = Receipt. | 
| 124 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message2).first
         | 
| 125 125 | 
             
                    assert mail
         | 
| 126 126 | 
             
                    if mail
         | 
| 127 127 | 
             
                      mail.read.should==false
         | 
| @@ -158,7 +158,7 @@ describe "Messages And Receipts" do | |
| 158 158 |  | 
| 159 159 | 
             
                  it "should create proper mails" do
         | 
| 160 160 | 
             
                    #Sender Mail
         | 
| 161 | 
            -
                    mail = Receipt. | 
| 161 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message2).first
         | 
| 162 162 | 
             
                    assert mail
         | 
| 163 163 | 
             
                    if mail
         | 
| 164 164 | 
             
                      mail.read.should==true
         | 
| @@ -166,7 +166,7 @@ describe "Messages And Receipts" do | |
| 166 166 | 
             
                      mail.mailbox_type.should=="sentbox"
         | 
| 167 167 | 
             
                    end      
         | 
| 168 168 | 
             
                    #Receiver Mail
         | 
| 169 | 
            -
                    mail = Receipt. | 
| 169 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message2).first
         | 
| 170 170 | 
             
                    assert mail
         | 
| 171 171 | 
             
                    if mail
         | 
| 172 172 | 
             
                      mail.read.should==false
         | 
| @@ -210,7 +210,7 @@ describe "Messages And Receipts" do | |
| 210 210 |  | 
| 211 211 | 
             
                  it "should create proper mails" do
         | 
| 212 212 | 
             
                    #Sender Mail
         | 
| 213 | 
            -
                    mail = Receipt. | 
| 213 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message1).first
         | 
| 214 214 | 
             
                    assert mail
         | 
| 215 215 | 
             
                    if mail
         | 
| 216 216 | 
             
                      mail.read.should==true
         | 
| @@ -218,7 +218,7 @@ describe "Messages And Receipts" do | |
| 218 218 | 
             
                      mail.mailbox_type.should=="sentbox"
         | 
| 219 219 | 
             
                    end      
         | 
| 220 220 | 
             
                    #Receiver Mail
         | 
| 221 | 
            -
                    mail = Receipt. | 
| 221 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message1).first
         | 
| 222 222 | 
             
                    assert mail
         | 
| 223 223 | 
             
                    if mail
         | 
| 224 224 | 
             
                      mail.read.should==false
         | 
| @@ -253,7 +253,7 @@ describe "Messages And Receipts" do | |
| 253 253 |  | 
| 254 254 | 
             
                  it "should create proper mails" do
         | 
| 255 255 | 
             
                    #Sender Mail
         | 
| 256 | 
            -
                    mail = Receipt. | 
| 256 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message2).first
         | 
| 257 257 | 
             
                    assert mail
         | 
| 258 258 | 
             
                    if mail
         | 
| 259 259 | 
             
                      mail.read.should==true
         | 
| @@ -261,7 +261,7 @@ describe "Messages And Receipts" do | |
| 261 261 | 
             
                      mail.mailbox_type.should=="sentbox"
         | 
| 262 262 | 
             
                    end      
         | 
| 263 263 | 
             
                    #Receiver Mail
         | 
| 264 | 
            -
                    mail = Receipt. | 
| 264 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message2).first
         | 
| 265 265 | 
             
                    assert mail
         | 
| 266 266 | 
             
                    if mail
         | 
| 267 267 | 
             
                      mail.read.should==false
         | 
| @@ -299,7 +299,7 @@ describe "Messages And Receipts" do | |
| 299 299 |  | 
| 300 300 | 
             
                  it "should create proper mails" do
         | 
| 301 301 | 
             
                    #Sender Mail
         | 
| 302 | 
            -
                    mail = Receipt. | 
| 302 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message2).first
         | 
| 303 303 | 
             
                    assert mail
         | 
| 304 304 | 
             
                    if mail
         | 
| 305 305 | 
             
                      mail.read.should==true
         | 
| @@ -307,7 +307,7 @@ describe "Messages And Receipts" do | |
| 307 307 | 
             
                      mail.mailbox_type.should=="sentbox"
         | 
| 308 308 | 
             
                    end      
         | 
| 309 309 | 
             
                    #Receiver Mail
         | 
| 310 | 
            -
                    mail = Receipt. | 
| 310 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message2).first
         | 
| 311 311 | 
             
                    assert mail
         | 
| 312 312 | 
             
                    if mail
         | 
| 313 313 | 
             
                      mail.read.should==false
         | 
| @@ -376,7 +376,7 @@ describe "Messages And Receipts" do | |
| 376 376 |  | 
| 377 377 | 
             
                  it "should create proper mails" do
         | 
| 378 378 | 
             
                    #Sender Mail
         | 
| 379 | 
            -
                    mail = Receipt. | 
| 379 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message1).first
         | 
| 380 380 | 
             
                    assert mail
         | 
| 381 381 | 
             
                    if mail
         | 
| 382 382 | 
             
                      mail.read.should==true
         | 
| @@ -385,7 +385,7 @@ describe "Messages And Receipts" do | |
| 385 385 | 
             
                    end      
         | 
| 386 386 | 
             
                    #Receiver Mails
         | 
| 387 387 | 
             
                    @recipients.each do |receiver|
         | 
| 388 | 
            -
                      mail = Receipt. | 
| 388 | 
            +
                      mail = Receipt.recipient(receiver).notification(@message1).first
         | 
| 389 389 | 
             
                      assert mail
         | 
| 390 390 | 
             
                      if mail
         | 
| 391 391 | 
             
                        mail.read.should==false
         | 
| @@ -422,7 +422,7 @@ describe "Messages And Receipts" do | |
| 422 422 |  | 
| 423 423 | 
             
                  it "should create proper mails" do
         | 
| 424 424 | 
             
                    #Sender Mail
         | 
| 425 | 
            -
                    mail = Receipt. | 
| 425 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message2).first
         | 
| 426 426 | 
             
                    assert mail
         | 
| 427 427 | 
             
                    if mail
         | 
| 428 428 | 
             
                      mail.read.should==true
         | 
| @@ -430,7 +430,7 @@ describe "Messages And Receipts" do | |
| 430 430 | 
             
                      mail.mailbox_type.should=="sentbox"
         | 
| 431 431 | 
             
                    end      
         | 
| 432 432 | 
             
                    #Receiver Mail
         | 
| 433 | 
            -
                    mail = Receipt. | 
| 433 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message2).first
         | 
| 434 434 | 
             
                    assert mail
         | 
| 435 435 | 
             
                    if mail
         | 
| 436 436 | 
             
                      mail.read.should==false
         | 
| @@ -439,7 +439,7 @@ describe "Messages And Receipts" do | |
| 439 439 | 
             
                    end
         | 
| 440 440 |  | 
| 441 441 | 
             
                    #No Receiver, No Mail
         | 
| 442 | 
            -
                    mail = Receipt. | 
| 442 | 
            +
                    mail = Receipt.recipient(@entity3).notification(@message2).first
         | 
| 443 443 | 
             
                    assert mail.nil?
         | 
| 444 444 |  | 
| 445 445 | 
             
                  end
         | 
| @@ -478,7 +478,7 @@ describe "Messages And Receipts" do | |
| 478 478 |  | 
| 479 479 | 
             
                  it "should create proper mails" do
         | 
| 480 480 | 
             
                    #Sender Mail
         | 
| 481 | 
            -
                    mail = Receipt. | 
| 481 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message2).first
         | 
| 482 482 | 
             
                    assert mail
         | 
| 483 483 | 
             
                    if mail
         | 
| 484 484 | 
             
                      mail.read.should==true
         | 
| @@ -487,7 +487,7 @@ describe "Messages And Receipts" do | |
| 487 487 | 
             
                    end      
         | 
| 488 488 | 
             
                    #Receiver Mails
         | 
| 489 489 | 
             
                    @recipients2.each do |receiver|
         | 
| 490 | 
            -
                      mail = Receipt. | 
| 490 | 
            +
                      mail = Receipt.recipient(receiver).notification(@message2).first
         | 
| 491 491 | 
             
                      assert mail
         | 
| 492 492 | 
             
                      if mail
         | 
| 493 493 | 
             
                        mail.read.should==false
         | 
| @@ -558,7 +558,7 @@ describe "Messages And Receipts" do | |
| 558 558 |  | 
| 559 559 | 
             
                  it "should create proper mails" do
         | 
| 560 560 | 
             
                    #Sender Mail
         | 
| 561 | 
            -
                    mail = Receipt. | 
| 561 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message1).first
         | 
| 562 562 | 
             
                    assert mail
         | 
| 563 563 | 
             
                    if mail
         | 
| 564 564 | 
             
                      mail.read.should==true
         | 
| @@ -567,7 +567,7 @@ describe "Messages And Receipts" do | |
| 567 567 | 
             
                    end      
         | 
| 568 568 | 
             
                    #Receiver Mails
         | 
| 569 569 | 
             
                    @recipients.each do |receiver|
         | 
| 570 | 
            -
                      mail = Receipt. | 
| 570 | 
            +
                      mail = Receipt.recipient(receiver).notification(@message1).first
         | 
| 571 571 | 
             
                      assert mail
         | 
| 572 572 | 
             
                      if mail
         | 
| 573 573 | 
             
                        mail.read.should==false
         | 
| @@ -604,7 +604,7 @@ describe "Messages And Receipts" do | |
| 604 604 |  | 
| 605 605 | 
             
                  it "should create proper mails" do
         | 
| 606 606 | 
             
                    #Sender Mail
         | 
| 607 | 
            -
                    mail = Receipt. | 
| 607 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message2).first
         | 
| 608 608 | 
             
                    assert mail
         | 
| 609 609 | 
             
                    if mail
         | 
| 610 610 | 
             
                      mail.read.should==true
         | 
| @@ -612,7 +612,7 @@ describe "Messages And Receipts" do | |
| 612 612 | 
             
                      mail.mailbox_type.should=="sentbox"
         | 
| 613 613 | 
             
                    end      
         | 
| 614 614 | 
             
                    #Receiver Mail
         | 
| 615 | 
            -
                    mail = Receipt. | 
| 615 | 
            +
                    mail = Receipt.recipient(@entity1).notification(@message2).first
         | 
| 616 616 | 
             
                    assert mail
         | 
| 617 617 | 
             
                    if mail
         | 
| 618 618 | 
             
                      mail.read.should==false
         | 
| @@ -621,7 +621,7 @@ describe "Messages And Receipts" do | |
| 621 621 | 
             
                    end
         | 
| 622 622 |  | 
| 623 623 | 
             
                    #No Receiver, No Mail
         | 
| 624 | 
            -
                    mail = Receipt. | 
| 624 | 
            +
                    mail = Receipt.recipient(@entity3).notification(@message2).first
         | 
| 625 625 | 
             
                    assert mail.nil?
         | 
| 626 626 |  | 
| 627 627 | 
             
                  end
         | 
| @@ -660,7 +660,7 @@ describe "Messages And Receipts" do | |
| 660 660 |  | 
| 661 661 | 
             
                  it "should create proper mails" do
         | 
| 662 662 | 
             
                    #Sender Mail
         | 
| 663 | 
            -
                    mail = Receipt. | 
| 663 | 
            +
                    mail = Receipt.recipient(@entity2).notification(@message2).first
         | 
| 664 664 | 
             
                    assert mail
         | 
| 665 665 | 
             
                    if mail
         | 
| 666 666 | 
             
                      mail.read.should==true
         | 
| @@ -669,7 +669,7 @@ describe "Messages And Receipts" do | |
| 669 669 | 
             
                    end      
         | 
| 670 670 | 
             
                    #Receiver Mails
         | 
| 671 671 | 
             
                    @recipients2.each do |receiver|
         | 
| 672 | 
            -
                      mail = Receipt. | 
| 672 | 
            +
                      mail = Receipt.recipient(receiver).notification(@message2).first
         | 
| 673 673 | 
             
                      assert mail
         | 
| 674 674 | 
             
                      if mail
         | 
| 675 675 | 
             
                        mail.read.should==false
         | 
    
        data/spec/models/mailbox_spec.rb
    CHANGED
    
    | @@ -31,17 +31,17 @@ describe Mailbox do | |
| 31 31 | 
             
              it "should return all mail" do 
         | 
| 32 32 | 
             
                assert @entity1.mailbox.receipts
         | 
| 33 33 | 
             
                @entity1.mailbox.receipts.count.should==4
         | 
| 34 | 
            -
                @entity1.mailbox.receipts[0].should==Receipt. | 
| 35 | 
            -
                @entity1.mailbox.receipts[1].should==Receipt. | 
| 36 | 
            -
                @entity1.mailbox.receipts[2].should==Receipt. | 
| 37 | 
            -
                @entity1.mailbox.receipts[3].should==Receipt. | 
| 34 | 
            +
                @entity1.mailbox.receipts[0].should==Receipt.recipient(@entity1).conversation(@conversation)[0]
         | 
| 35 | 
            +
                @entity1.mailbox.receipts[1].should==Receipt.recipient(@entity1).conversation(@conversation)[1]
         | 
| 36 | 
            +
                @entity1.mailbox.receipts[2].should==Receipt.recipient(@entity1).conversation(@conversation)[2]
         | 
| 37 | 
            +
                @entity1.mailbox.receipts[3].should==Receipt.recipient(@entity1).conversation(@conversation)[3]
         | 
| 38 38 |  | 
| 39 39 | 
             
                assert @entity2.mailbox.receipts
         | 
| 40 40 | 
             
                @entity2.mailbox.receipts.count.should==4
         | 
| 41 | 
            -
                @entity2.mailbox.receipts[0].should==Receipt. | 
| 42 | 
            -
                @entity2.mailbox.receipts[1].should==Receipt. | 
| 43 | 
            -
                @entity2.mailbox.receipts[2].should==Receipt. | 
| 44 | 
            -
                @entity2.mailbox.receipts[3].should==Receipt. | 
| 41 | 
            +
                @entity2.mailbox.receipts[0].should==Receipt.recipient(@entity2).conversation(@conversation)[0]
         | 
| 42 | 
            +
                @entity2.mailbox.receipts[1].should==Receipt.recipient(@entity2).conversation(@conversation)[1]
         | 
| 43 | 
            +
                @entity2.mailbox.receipts[2].should==Receipt.recipient(@entity2).conversation(@conversation)[2]
         | 
| 44 | 
            +
                @entity2.mailbox.receipts[3].should==Receipt.recipient(@entity2).conversation(@conversation)[3]    
         | 
| 45 45 | 
             
              end
         | 
| 46 46 |  | 
| 47 47 | 
             
              it "should return sentbox" do
         | 
| @@ -59,13 +59,13 @@ describe Mailbox do | |
| 59 59 | 
             
              it "should return inbox" do
         | 
| 60 60 | 
             
                assert @entity1.mailbox.receipts.inbox
         | 
| 61 61 | 
             
                @entity1.mailbox.receipts.inbox.count.should==2
         | 
| 62 | 
            -
                @entity1.mailbox.receipts.inbox[0].should==Receipt. | 
| 63 | 
            -
                @entity1.mailbox.receipts.inbox[1].should==Receipt. | 
| 62 | 
            +
                @entity1.mailbox.receipts.inbox[0].should==Receipt.recipient(@entity1).inbox.conversation(@conversation)[0]
         | 
| 63 | 
            +
                @entity1.mailbox.receipts.inbox[1].should==Receipt.recipient(@entity1).inbox.conversation(@conversation)[1]
         | 
| 64 64 |  | 
| 65 65 | 
             
                assert @entity2.mailbox.receipts.inbox
         | 
| 66 66 | 
             
                @entity2.mailbox.receipts.inbox.count.should==2
         | 
| 67 | 
            -
                @entity2.mailbox.receipts.inbox[0].should==Receipt. | 
| 68 | 
            -
                @entity2.mailbox.receipts.inbox[1].should==Receipt. | 
| 67 | 
            +
                @entity2.mailbox.receipts.inbox[0].should==Receipt.recipient(@entity2).inbox.conversation(@conversation)[0]
         | 
| 68 | 
            +
                @entity2.mailbox.receipts.inbox[1].should==Receipt.recipient(@entity2).inbox.conversation(@conversation)[1]
         | 
| 69 69 | 
             
              end
         | 
| 70 70 |  | 
| 71 71 | 
             
              it "should return trashed mails" do 
         | 
| @@ -73,10 +73,10 @@ describe Mailbox do | |
| 73 73 |  | 
| 74 74 | 
             
                assert @entity1.mailbox.receipts.trash
         | 
| 75 75 | 
             
                @entity1.mailbox.receipts.trash.count.should==4
         | 
| 76 | 
            -
                @entity1.mailbox.receipts.trash[0].should==Receipt. | 
| 77 | 
            -
                @entity1.mailbox.receipts.trash[1].should==Receipt. | 
| 78 | 
            -
                @entity1.mailbox.receipts.trash[2].should==Receipt. | 
| 79 | 
            -
                @entity1.mailbox.receipts.trash[3].should==Receipt. | 
| 76 | 
            +
                @entity1.mailbox.receipts.trash[0].should==Receipt.recipient(@entity1).conversation(@conversation)[0]
         | 
| 77 | 
            +
                @entity1.mailbox.receipts.trash[1].should==Receipt.recipient(@entity1).conversation(@conversation)[1]
         | 
| 78 | 
            +
                @entity1.mailbox.receipts.trash[2].should==Receipt.recipient(@entity1).conversation(@conversation)[2]
         | 
| 79 | 
            +
                @entity1.mailbox.receipts.trash[3].should==Receipt.recipient(@entity1).conversation(@conversation)[3]
         | 
| 80 80 |  | 
| 81 81 | 
             
                assert @entity2.mailbox.receipts.trash
         | 
| 82 82 | 
             
                @entity2.mailbox.receipts.trash.count.should==0    
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: mailboxer
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 21
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 2
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.2. | 
| 9 | 
            +
              - 1
         | 
| 10 | 
            +
              version: 0.2.1
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Eduardo Casanova Cuesta
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2011-06- | 
| 18 | 
            +
            date: 2011-06-24 00:00:00 +02:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 20 | 
             
            dependencies: 
         | 
| 21 21 | 
             
            - !ruby/object:Gem::Dependency 
         |