Sha256: 52ac97d0d8bdcf31cd9cadbe128edc69637844d9b41a7cbb8383482a8d810f4b

Contents?: true

Size: 1.36 KB

Versions: 34

Compression:

Stored size: 1.36 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe "Twitter::DirectMessage" do
  it "should create new direct message from xml doc" do
    xml = <<EOF
<direct_message>
  <id>331681</id>
  <text>thanks for revving the twitter gem! had notice that it was broken but didn't have time to patch.</text>
  <sender_id>18713</sender_id>
  <recipient_id>4243</recipient_id>
  <created_at>Sat Mar 10 22:10:37 +0000 2007</created_at>
  <sender_screen_name>al3x</sender_screen_name>
  <recipient_screen_name>jnunemaker</recipient_screen_name>
</direct_message>
EOF
    d = Twitter::DirectMessage.new do |d|
      d.id                    = '331681'
      d.text                  = "thanks for revving the twitter gem! had notice that it was broken but didn't have time to patch."
      d.sender_id             = '18713'
      d.recipient_id          = '4243'
      d.created_at            = 'Sat Mar 10 22:10:37 +0000 2007'
      d.sender_screen_name    = 'al3x'
      d.recipient_screen_name = 'jnunemaker'
    end
    d2 = Twitter::DirectMessage.new_from_xml(Hpricot.XML(xml))
    
    d.id.should == d2.id
    d.text.should == d2.text
    d.sender_id.should == d2.sender_id
    d.recipient_id.should == d2.recipient_id
    d.created_at.should == d2.created_at
    d.sender_screen_name.should == d2.sender_screen_name
    d.recipient_screen_name.should == d2.recipient_screen_name
  end
end

Version data entries

34 entries across 34 versions & 12 rubygems

Version Path
anthonycrumley-twitter-0.3.8 spec/direct_message_spec.rb
baron-twitter-0.4.2 spec/direct_message_spec.rb
billymeltdown-twitter-0.3.8.1 spec/direct_message_spec.rb
billymeltdown-twitter-0.4.2 spec/direct_message_spec.rb
billymeltdown-twitter-0.4.3 spec/direct_message_spec.rb
drnic-twitter-0.4.4.1 spec/direct_message_spec.rb
dschn-twitter-0.3.7.1 spec/direct_message_spec.rb
dschn-twitter-0.3.7.2 spec/direct_message_spec.rb
dschn-twitter-0.4.1.1 spec/direct_message_spec.rb
dschn-twitter-0.4.1.2 spec/direct_message_spec.rb
dschn-twitter-0.4.1.3 spec/direct_message_spec.rb
dschn-twitter-0.4.1 spec/direct_message_spec.rb
dustin-twitter-0.3.2.1 spec/direct_message_spec.rb
dustin-twitter-0.3.2.2 spec/direct_message_spec.rb
dustin-twitter-0.3.7 spec/direct_message_spec.rb
handcrafted-twitter-0.4.0 spec/direct_message_spec.rb
handcrafted-twitter-0.4.2 spec/direct_message_spec.rb
jnunemaker-twitter-0.2.8 spec/direct_message_spec.rb
jnunemaker-twitter-0.3.1 spec/direct_message_spec.rb
jnunemaker-twitter-0.3.4 spec/direct_message_spec.rb