Sha256: a1407caebcf6f31a0b4646643b935f3883efdbb54ed436bcb02205a70279cb31

Contents?: true

Size: 1.58 KB

Versions: 38

Compression:

Stored size: 1.58 KB

Contents

require 'spec_helper'
require 'contentful/management/space'
require 'contentful/management/client'

module Contentful
  module Management
    describe User do
      let(:token) { ENV.fetch('CF_TEST_CMA_TOKEN', '<ACCESS_TOKEN>') }
      let!(:client) { Client.new(token) }

      subject { client.users }

      describe '.all' do
        it 'is not supported' do
          expect { subject.all }.to raise_error 'Not supported'
        end
      end

      describe '.find' do
        it 'fetches the current user' do
          vcr('user/find') {
            user = subject.find('me')
            expect(user).to be_a Contentful::Management::User
            expect(user.first_name).to eq 'David'
            expect(user.last_name).to eq 'Test'
            expect(user.email).to eq 'david.test@testytest.com'
            expect(user.activated).to eq true
            expect(user.confirmed).to eq true
            expect(user.sign_in_count).to eq 26
            expect(user.avatar_url).to be_truthy
          }
        end
      end

      describe '.me' do
        it 'is an alias to .find("me")' do
          vcr('user/find') {
            user = subject.me
            expect(user).to be_a Contentful::Management::User
            expect(user.first_name).to eq 'David'
            expect(user.last_name).to eq 'Test'
            expect(user.email).to eq 'david.test@testytest.com'
            expect(user.activated).to eq true
            expect(user.confirmed).to eq true
            expect(user.sign_in_count).to eq 26
            expect(user.avatar_url).to be_truthy
          }
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
contentful-management-3.10.0 spec/lib/contentful/management/user_spec.rb
contentful-management-3.9.0 spec/lib/contentful/management/user_spec.rb
contentful-management-3.8.0 spec/lib/contentful/management/user_spec.rb
contentful-management-3.7.0 spec/lib/contentful/management/user_spec.rb
contentful-management-3.6.0 spec/lib/contentful/management/user_spec.rb
contentful-management-3.5.0 spec/lib/contentful/management/user_spec.rb
contentful-management-3.4.0 spec/lib/contentful/management/user_spec.rb
contentful-management-3.3.0 spec/lib/contentful/management/user_spec.rb
contentful-management-3.2.0 spec/lib/contentful/management/user_spec.rb
contentful-management-3.1.0 spec/lib/contentful/management/user_spec.rb
contentful-management-3.0.0 spec/lib/contentful/management/user_spec.rb
contentful-management-2.13.1 spec/lib/contentful/management/user_spec.rb
contentful-management-2.13.0 spec/lib/contentful/management/user_spec.rb
contentful-management-2.12.1 spec/lib/contentful/management/user_spec.rb
contentful-management-2.12.0 spec/lib/contentful/management/user_spec.rb
contentful-management-2.11.0 spec/lib/contentful/management/user_spec.rb
contentful-management-2.10.0 spec/lib/contentful/management/user_spec.rb
contentful-management-2.9.1 spec/lib/contentful/management/user_spec.rb
contentful-management-2.9.0 spec/lib/contentful/management/user_spec.rb
contentful-management-2.8.2 spec/lib/contentful/management/user_spec.rb