Sha256: 3b7bd1ca01005d3cfefd3688835e00cb5361319bac580bad8f2525647ab2c7de

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require "spec_helper"

describe "group messages" do
  let(:alice) { User.find_by_email("alice@example.com") }
  let(:bob)   { User.find_by_email("bob@example.com") }
  let(:pat)   { User.find_by_email("pat@example.com") }

  before do
    User.acts_as_messageable :group_messages => true
    @message = alice.send_message(bob, :topic => "Helou bob!", :body => "What's up?")
  end

  it "joins to conversation" do
    @reply_message = pat.reply_to(@message, "Hi there!", "I would like to join to this conversation!")
    @sec_reply_message = bob.reply_to(@message, "Hi!", "Fine!")
    @third_reply_message = alice.reply_to(@reply_message, "hi!", "no problem")
    @message.conversation.should include(@sec_reply_message, @third_reply_message, @reply_message, @message)
  end

  it "alice,bob and pat should be involve into conversation" do
    @reply_message = pat.reply_to(@message, "Hi there!", "I would like to join to this conversation!")
    @sec_reply_message = bob.reply_to(@message, "Hi!", "Fine!")
    @third_reply_message = alice.reply_to(@reply_message, "hi!", "no problem")
    @message.people.should == [alice, bob, pat]
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts-as-messageable-0.4.10 spec/group-messages_spec.rb
acts-as-messageable-0.4.9 spec/group-messages_spec.rb