Sha256: 73e7e5500bbf1fc02c630391fbf9a0133e391036cec00ba68c316ca1c1220305

Contents?: true

Size: 1.29 KB

Versions: 33

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'

describe Message do
  fixtures :all

  before(:each) do
    @message = FactoryGirl.create(:message)
  end

  it "should require body" do
    @message.errors[:body].should be_true
  end

  it "should require recipient" do
    @message.errors[:recipient].should be_true
  end

  it "should require subject" do
    @message.errors[:subject].should be_true
  end
  
  it "should return sender_name" do
    @message.sender.username.should be_true
  end

  it "should return receiver_name" do
    @message.receiver = users(:user1)
    @message.receiver.username.should be_true
  end
  
  it "should set read_at" do
    message = messages(:user2_to_user1_1)
    message.sm_read!
    message.read_at.should be_true
    message.read?.should be_true
    message.state.should eq 'read'
  end
end


# == Schema Information
#
# Table name: messages
#
#  id                 :integer         not null, primary key
#  read_at            :datetime
#  receiver_id        :integer
#  sender_id          :integer
#  subject            :string(255)     not null
#  body               :text
#  created_at         :datetime
#  updated_at         :datetime
#  message_request_id :integer
#  state              :string(255)
#  parent_id          :integer
#  lft                :integer
#  rgt                :integer
#

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
enju_message-0.1.14.pre2 spec/models/message_spec.rb
enju_message-0.1.14.pre spec/models/message_spec.rb
enju_message-0.1.13 spec/models/message_spec.rb
enju_message-0.1.12 spec/models/message_spec.rb
enju_message-0.1.11 spec/models/message_spec.rb
enju_message-0.0.25 spec/models/message_spec.rb
enju_message-0.1.9 spec/models/message_spec.rb
enju_message-0.0.24 spec/models/message_spec.rb
enju_message-0.1.8 spec/models/message_spec.rb
enju_message-0.0.23 spec/models/message_spec.rb
enju_message-0.1.7 spec/models/message_spec.rb
enju_message-0.0.22 spec/models/message_spec.rb
enju_message-0.1.6 spec/models/message_spec.rb
enju_message-0.0.21 spec/models/message_spec.rb
enju_message-0.1.5 spec/models/message_spec.rb
enju_message-0.0.20 spec/models/message_spec.rb
enju_message-0.1.4 spec/models/message_spec.rb
enju_message-0.1.3 spec/models/message_spec.rb
enju_message-0.1.2 spec/models/message_spec.rb
enju_message-0.0.19 spec/models/message_spec.rb