Sha256: 849edf1cfe9837a64cc65199c7f78a722bd844282bf08989d9522b6f8460e8b5

Contents?: true

Size: 1.41 KB

Versions: 95

Compression:

Stored size: 1.41 KB

Contents

require 'spec_helper'

describe FbGraph::Message, '.new' do
  it 'should setup all supported attributes' do
    attributes = {
      :id => "12345",
      :created_time => "2011-02-04T15:11:05+0000",
      :tags => {
        :data => [{
          :name => "inbox"
        }, {
          :name => "source:web"
        }]
      },
      :from => {
        :name => "Nov Matake",
        :email => "abc@facebook.com",
        :id => "1575327134"
      },
      :to => {
        :data => [{
          :name => "Nov Matake",
          :email => "xyz@facebook.com",
          :id => "579612276"
        }, {
          :name => "Nov Matake",
          :email => "abc@facebook.com",
          :id => "1575327134"
        }]
      },
      :message => "test test"
    }
    message = FbGraph::Message.new(attributes.delete(:id), attributes)
    message.identifier.should == '12345'
    message.message.should == 'test test'
    message.created_time.should == Time.parse('2011-02-04T15:11:05+0000')
    message.tags.should == [
      FbGraph::Tag.new(:name => 'inbox'),
      FbGraph::Tag.new(:name => 'source:web')
    ]
    message.from.should == FbGraph::User.new('1575327134', :name => 'Nov Matake', :email => 'abc@facebook.com')
    message.to.should == [
      FbGraph::User.new('579612276', :name => 'Nov Matake', :email => 'xyz@facebook.com'),
      FbGraph::User.new('1575327134', :name => 'Nov Matake', :email => 'abc@facebook.com')
    ]
  end
end

Version data entries

95 entries across 95 versions & 1 rubygems

Version Path
fb_graph-2.7.17 spec/fb_graph/message_spec.rb
fb_graph-2.7.16 spec/fb_graph/message_spec.rb
fb_graph-2.7.15 spec/fb_graph/message_spec.rb
fb_graph-2.7.14 spec/fb_graph/message_spec.rb
fb_graph-2.7.13 spec/fb_graph/message_spec.rb
fb_graph-2.7.12 spec/fb_graph/message_spec.rb
fb_graph-2.7.11 spec/fb_graph/message_spec.rb
fb_graph-2.7.10 spec/fb_graph/message_spec.rb
fb_graph-2.7.9 spec/fb_graph/message_spec.rb
fb_graph-2.7.8 spec/fb_graph/message_spec.rb
fb_graph-2.7.7 spec/fb_graph/message_spec.rb
fb_graph-2.7.6 spec/fb_graph/message_spec.rb
fb_graph-2.7.5 spec/fb_graph/message_spec.rb
fb_graph-2.7.4 spec/fb_graph/message_spec.rb
fb_graph-2.7.3 spec/fb_graph/message_spec.rb
fb_graph-2.7.2 spec/fb_graph/message_spec.rb
fb_graph-2.7.1 spec/fb_graph/message_spec.rb
fb_graph-2.7.0 spec/fb_graph/message_spec.rb
fb_graph-2.6.7 spec/fb_graph/message_spec.rb
fb_graph-2.6.6 spec/fb_graph/message_spec.rb