mjfreshyfresh-mini_fb 0.1.18 → 0.1.19
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mini_fb.rb +3 -0
- data/test/test_mini_fb.rb +7 -0
- metadata +1 -1
data/lib/mini_fb.rb
CHANGED
@@ -190,6 +190,9 @@ module MiniFB
|
|
190
190
|
|
191
191
|
begin
|
192
192
|
data = JSON.parse body
|
193
|
+
|
194
|
+
data.collect! {|datum| Hashie::Mash.new datum } if data.is_a?(Array) && data.length > 0 && data[0].is_a?(Hash)
|
195
|
+
|
193
196
|
puts 'response=' + data.inspect if @@logging
|
194
197
|
if data.include?( "error_msg" ) then
|
195
198
|
raise FaceBookError.new( data["error_code"] || 1, data["error_msg"] )
|
data/test/test_mini_fb.rb
CHANGED
@@ -50,6 +50,13 @@ class MiniFBTests < Test::Unit::TestCase
|
|
50
50
|
assert results.is_a?(Array)
|
51
51
|
end
|
52
52
|
|
53
|
+
test 'Should return Hashie objects within array if array contains hashes' do
|
54
|
+
results = @facebook_session.call 'Photos.getAlbums', :uid => FB_USER_ID
|
55
|
+
assert results.is_a?(Array)
|
56
|
+
assert results.length > 0 # The profile pics should show up at the very least.
|
57
|
+
assert results[0].is_a?(Hashie::Mash)
|
58
|
+
end
|
59
|
+
|
53
60
|
test 'should not create Hashie object if return is string' do
|
54
61
|
results = @facebook_session.call 'users.getLoggedInUser'
|
55
62
|
assert results.is_a?(String)
|