Permalink
Browse files

Restore to_hash

  • Loading branch information...
1 parent a8c96d9 commit 13d95f0867cde190b729c3f78934ed6ee979dc33 @sferik committed Oct 18, 2011
Showing with 9 additions and 2 deletions.
  1. +1 −1 lib/twitter/status.rb
  2. +1 −1 lib/twitter/user.rb
  3. +7 −0 spec/twitter/base_spec.rb
View
2 lib/twitter/status.rb
@@ -55,7 +55,7 @@ def urls
end
def user
- @user ||= Twitter::User.new(@attributes['user']) unless @attributes['user'].nil?
+ @user ||= Twitter::User.new(@attributes['user'].merge('status' => self.to_hash.delete_if{|key, value| key == 'user'})) unless @attributes['user'].nil?
end
def user_mentions
View
2 lib/twitter/user.rb
@@ -54,7 +54,7 @@ def ==(other)
end
def status
- @status ||= Twitter::Status.new(@attributes['status']) unless @attributes['status'].nil?
+ @status ||= Twitter::Status.new(@attributes['status'].merge('user' => self.to_hash.delete_if{|key, value| key == 'status'})) unless @attributes['status'].nil?
end
end
View
7 spec/twitter/base_spec.rb
@@ -15,4 +15,11 @@
end
end
+ describe "#to_hash" do
+ it "should return a hash" do
+ @base.to_hash.should be_a Hash
+ @base.to_hash['id'].should == 1
+ end
+ end
+
end

0 comments on commit 13d95f0

Please sign in to comment.