Sha256: 63c98db7beef6c6f04f8d96e322567bd3af3b3427b035abf79f77ccf7d6a052f

Contents?: true

Size: 1.95 KB

Versions: 3

Compression:

Stored size: 1.95 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/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/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/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/repositories/dashboard', {}, {})
      @user.dashboard
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bitbucket_rest_api2-0.9.1 spec/bitbucket_rest_api/user_spec.rb
bitbucket_rest_api2-0.2.2 spec/bitbucket_rest_api/user_spec.rb
bitbucket_rest_api2-0.2.1 spec/bitbucket_rest_api/user_spec.rb