Sha256: 747acac41da96a20ce4ceb5ef68e3ec589cfd02a2df3c10c0423bbe79d3b615d

Contents?: true

Size: 1.51 KB

Versions: 20

Compression:

Stored size: 1.51 KB

Contents

require File.join(File.dirname(__FILE__), '../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

20 entries across 20 versions & 1 rubygems

Version Path
fb_graph-1.7.0 spec/fb_graph/message_spec.rb
fb_graph-1.7.0.alpha2 spec/fb_graph/message_spec.rb
fb_graph-1.6.9 spec/fb_graph/message_spec.rb
fb_graph-1.7.0.alpha spec/fb_graph/message_spec.rb
fb_graph-1.6.8 spec/fb_graph/message_spec.rb
fb_graph-1.6.7 spec/fb_graph/message_spec.rb
fb_graph-1.6.5 spec/fb_graph/message_spec.rb
fb_graph-1.6.4 spec/fb_graph/message_spec.rb
fb_graph-1.6.3 spec/fb_graph/message_spec.rb
fb_graph-1.6.2 spec/fb_graph/message_spec.rb
fb_graph-1.6.1 spec/fb_graph/message_spec.rb
fb_graph-1.6.0 spec/fb_graph/message_spec.rb
fb_graph-1.5.5 spec/fb_graph/message_spec.rb
fb_graph-1.5.4 spec/fb_graph/message_spec.rb
fb_graph-1.5.3 spec/fb_graph/message_spec.rb
fb_graph-1.5.2 spec/fb_graph/message_spec.rb
fb_graph-1.5.1 spec/fb_graph/message_spec.rb
fb_graph-1.5.0 spec/fb_graph/message_spec.rb
fb_graph-1.4.1 spec/fb_graph/message_spec.rb
fb_graph-1.4.0 spec/fb_graph/message_spec.rb