Sha256: 3fd5142d4f063d1e7f47010782fd1485867b0ededb79c330e960c245be5b5623

Contents?: true

Size: 1.97 KB

Versions: 1

Compression:

Stored size: 1.97 KB

Contents

require 'spec_helper'

describe BitBucket::User do
  let(:options) do
    {
      client_id:     'example_client_id',
      client_secret: 'example_client_secret',
      oauth_token:   'example_oauth_token',
      oauth_secret:  'example_oauth_secret',
      adapter:       :net_http
    }
  end

  before do
    @user = BitBucket::User.new(options)
  end

  describe '#profile' do
    it 'sends the request to the right url' do
      expect(@user).to receive(:request).with(:get, '/2.0/user', {}, {})
      @user.profile
    end
  end

  describe '#update' do
    let(:params) do
      { first_name: 'first-name', last_name: 'last-name', avatar: '' }
    end

    it 'sends the request to the right url' do
      expect(@user).to receive(:request).with(:put, '/2.0/user', params, {})
      @user.update(params)
    end
  end

  describe '#privileges' do
    it 'sends the request to the right url' do
      expect(@user).to receive(:request).with(:get, '/2.0/user/privileges', {}, {})
      @user.privileges
    end
  end

  describe '#follows' do
    it 'sends the request to the right url' do
      expect(@user).to receive(:request).with(:get, '/2.0/user/follows', {}, {})
      @user.follows
    end
  end

  describe '#repositories' do
    it 'sends the request to the right url' do
      expect(@user).to receive(:request).with(:get, '/2.0/user/repositories', {}, {})
      @user.repositories
    end
  end

  describe '#repos' do
    it 'sends the request to the right url' do
      expect(@user).to receive(:request).with(:get, '/2.0/user/repositories', {}, {})
      @user.repos
    end
  end

  describe '#overview' do
    it 'sends the request to the right url' do
      expect(@user).to receive(:request).with(:get, '/2.0/user/repositories/overview', {}, {})
      @user.overview
    end
  end

  describe '#dashboard' do
    it 'sends the request to the right url' do
      expect(@user).to receive(:request).with(:get, '/2.0/user/repositories/dashboard', {}, {})
      @user.dashboard
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitbucket_rest_api2-0.2.0 spec/bitbucket_rest_api/user_spec.rb