Sha256: ab7382cfe54e756798085e01b98c514d6dd4524aeb5ce77348ee34026578de67

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

# encoding: utf-8
require "spec_helper"

describe Vkontakte::Api::Profile do
  it "should be valid" do
    Vkontakte::Api::Profile.should be_a(Module)
  end

  context "params" do
    before(:each) do
      @token = '7a1cfdd37a3b72167a3b7216ac7a1347bde7a3b7a3a7216c95a735a210be6d4'
      @user = Vkontakte::App::User.new('2592709', :access_token => @token)

      response = '{"response":[{"uid":2592709, "last_name":"Галета", "first_name":"Павел"}]}'
      friends_response = '{"response": {"count": 8, "items": [233297, 424407, 593420, 705017, 830116, 838081, 1075165, 1312768]}}'

      FakeWeb.register_uri(:get,
        "https://api.vk.com/method/users.get?v=5.24&uids=2592709&access_token=#{@token}",
        :body => response)

      FakeWeb.register_uri(:get,
        "https://api.vk.com/method/users.getFollowers?v=5.24&user_id=2592709&access_token=#{@token}",
        :body => friends_response)

      FakeWeb.register_uri(:get,
        "https://api.vk.com/method/friends.get?v=5.24&user_id=2592709&access_token=#{@token}",
        :body => friends_response)
    end

    it "should be call users.get method" do
      @user.fetch.should_not be_blank
    end

    it "should have info in parsed_reponse" do
      @user.fetch.should eq [{"uid" => 2592709, "last_name" => "Галета", "first_name" => "Павел"}]
    end

    it "should be call friends method" do
      @user.fetch_friends["items"].size.should == 8
    end

    it "should be call followers method" do
      @user.fetch_followers["items"].size.should == 8
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vkontakte-0.0.7 spec/api/profile_spec.rb