Sha256: e12b6db913548006df64640157ee9227d1023181ca14eec3716b7df5e561b965

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Facemock::FbGraph::User do
  let(:db_name) { ".test" }

  let(:facebook_app_id) { "100000000000000" }
  let(:facebook_app_secret) { "test_secret" }

  before do
    stub_const("Facemock::Database::DEFAULT_DB_NAME", db_name)
    @database = Facemock::Database.new
  end
  after  { @database.drop }

  describe '.me' do
    context 'when access_token is correct' do
      before do
        app = Facemock::FbGraph::Application.new(facebook_app_id, secret: facebook_app_secret)
        @user = app.test_user!
        @access_token = @user.access_token
      end

      it 'can get user' do
        user = Facemock::FbGraph::User.me(@access_token)
        Facemock::FbGraph::Application::User.column_names.each do |column|
          expect(user.send(column)).to eq @user.send(column) unless column == "created_at"
        end
      end
    end

    context 'when access_token is incorrect' do
      subject { Facemock::FbGraph::User.me('incorrect_token') }
      it { is_expected.to eq nil }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facemock-0.0.5 spec/facemock/fb_graph/user_spec.rb