spec/people/vkontakte_spec.rb in social_profile-0.2.2 vs spec/people/vkontakte_spec.rb in social_profile-0.3.0
- old
+ new
@@ -27,10 +27,12 @@
to_return(:status => 200, :body => fixture("vkontakte/friends.json"))
stub_request(:get, "https://api.vk.com/method/users.getFollowers?access_token=abc&count=1000&fields=screen_name&offset=0&user_id=2592709").
to_return(:status => 200, :body => fixture("vkontakte/followers.json"))
stub_request(:get, "https://api.vk.com/method/wall.getReposts?access_token=abc&count=1000&offset=0&owner_id=2592709&post_id=3675").
to_return(:status => 200, :body => fixture("vkontakte/shares_post_3675.json"))
+ stub_request(:get, "https://api.vk.com/method/wall.getById?access_token=abc&extended=1&posts=2592709_655").
+ to_return(:status => 200, :body => fixture("vkontakte/post.json"))
end
it "should be a vkontakte profile" do
@user.should be_a(SocialProfile::People::Vkontakte)
end
@@ -108,8 +110,21 @@
to_return(:status => 200, :body => fixture("vkontakte/followers_20.json"))
stub_request(:get, "https://api.vk.com/method/users.getFollowers?access_token=abc&count=20&fields=screen_name&offset=20&user_id=2592709").
to_return(:status => 200, :body => fixture("vkontakte/followers_20_2.json"))
@user.followers(:count => 20).size.should == 30
+ end
+
+ it "should fetch post by id" do
+ response = @user.get_post("2592709_655")
+ response["items"].first["comments"]["count"].should == 3
+ end
+
+ it "should get mutual_friends" do
+ stub_request(:get, /friends\.getMutual/).
+ to_return(:status => 200, :body => fixture("vkontakte/mutual_friends.json"))
+
+ _hash = @user.mutual_friends(:target_uids => "seperated_ids")
+ _hash.size.should == 206
end
end
end