Sha256: 97e8535ccf5508f898b73447dbd3f6d9a292325d9ce19b09a564f507d2511944

Contents?: true

Size: 1.48 KB

Versions: 14

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

describe FbGraph::Message, '.new' do
  it 'should setup all supported attributes' do
    attributes = {
      :id => "12345",
      :subject => "test",
      :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.subject.should == 'test'
    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

14 entries across 14 versions & 1 rubygems

Version Path
fb_graph-1.8.6 spec/fb_graph/message_spec.rb
fb_graph-1.8.5 spec/fb_graph/message_spec.rb
fb_graph-1.8.4 spec/fb_graph/message_spec.rb
fb_graph-1.8.3 spec/fb_graph/message_spec.rb
fb_graph-1.8.2 spec/fb_graph/message_spec.rb
fb_graph-1.8.1 spec/fb_graph/message_spec.rb
fb_graph-1.8.0 spec/fb_graph/message_spec.rb
fb_graph-1.8.0.alpha2 spec/fb_graph/message_spec.rb
fb_graph-1.7.5 spec/fb_graph/message_spec.rb
fb_graph-1.8.0.alpha spec/fb_graph/message_spec.rb
fb_graph-1.7.4 spec/fb_graph/message_spec.rb
fb_graph-1.7.3 spec/fb_graph/message_spec.rb
fb_graph-1.7.2 spec/fb_graph/message_spec.rb
fb_graph-1.7.1 spec/fb_graph/message_spec.rb