Created
December 19, 2012 18:42
-
-
Save fabianoalmeida/4339255 to your computer and use it in GitHub Desktop.
Testing Mailbox #24 issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "should return all unread conversations at inbox" do | |
first = FactoryGirl.create(:user) | |
second = FactoryGirl.create(:user) | |
third = FactoryGirl.create(:user) | |
fourth = FactoryGirl.create(:user) | |
fifth = FactoryGirl.create(:user) | |
first_receipt = first.send_message(second, "Body", "Subject") | |
second_receipt = second.reply_to_sender(first_receipt, "Body") | |
third_receipt = first.reply_to_sender(second_receipt, "Body") | |
fourth_receipt = third.reply_to_all(third_receipt, "Body") | |
fifth_conversation = fourth.send_message(second, "Body", "Subject").conversation | |
sixth_conversation = fourth.send_message(fifth, "Body", "Subject").conversation | |
seventh_conversation = fifth.send_message(third, "Body", "Subject").conversation | |
eighth_conversation = second.send_message(fourth, "Body", "Subject").conversation | |
first_receipt.conversation.should eql(second_receipt.conversation) | |
first.mailbox.inbox(:unread => true).to_a.should have(1).items | |
first.mailbox.inbox.unread(first).to_a.should have(1).items | |
first.mailbox.inbox(:unread => true).first.should eql(first.mailbox.inbox.unread(first).first) | |
first.mailbox.inbox(:unread => true).count(:id, :distinct => true).should eql(1) | |
first.mailbox.inbox(:unread => true).should == first.mailbox.inbox.unread(first) | |
first.mailbox.inbox.unread(first).to_sql.should eql('s') | |
first.mailbox.inbox.unread(first).count.should eql(1) | |
second.mailbox.inbox(:unread => true).to_a.should have(3).items | |
second.mailbox.inbox.unread(second).to_a.should have(3).items | |
second.mailbox.inbox(:unread => true).first.should eql(second.mailbox.inbox.unread(second).first) | |
second.mailbox.inbox(:unread => true).count.should eql(3) | |
second.mailbox.inbox.unread(second).count.should eql(3) | |
third.mailbox.inbox(:unread => true).to_a.should have(1).items | |
third.mailbox.inbox.unread(third).to_a.should have(1).items | |
third.mailbox.inbox(:unread => true).first.should eql(third.mailbox.inbox.unread(third).first) | |
third.mailbox.inbox(:unread => true).count.should eql(1) | |
third.mailbox.inbox.unread(third).count.should eql(1) | |
fourth.mailbox.inbox(:unread => true).to_a.should have(1).items | |
fourth.mailbox.inbox.unread(fourth).to_a.should have(1).items | |
fourth.mailbox.inbox(:unread => true).first.should eql(fourth.mailbox.inbox.unread(fourth).first) | |
fourth.mailbox.inbox(:unread => true).count.should eql(1) | |
fourth.mailbox.inbox.unread(fourth).count.should eql(1) | |
fifth.mailbox.inbox(:unread => true).to_a.should have(1).items | |
fifth.mailbox.inbox.unread(fifth).to_a.should have(1).items | |
fifth.mailbox.inbox(:unread => true).first.should eql(fifth.mailbox.inbox.unread(fifth).first) | |
fifth.mailbox.inbox(:unread => true).count.should eql(1) | |
fifth.mailbox.inbox.unread(fifth).count.should eql(1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment