Sha256: 6624a37dcb119292f53ba5818334c4f127fb2d2875789e0d907903b74aa5a751

Contents?: true

Size: 1.97 KB

Versions: 5

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, '/1.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, '/1.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, '/1.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, '/1.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, '/1.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, '/1.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, '/1.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, '/1.0/user/repositories/dashboard', {}, {})
      @user.dashboard
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
zz_bitbucket_rest_api-0.1.11 spec/bitbucket_rest_api/user_spec.rb
zz_bitbucket_rest_api-0.1.10 spec/bitbucket_rest_api/user_spec.rb
zz_bitbucket_rest_api-0.1.9 spec/bitbucket_rest_api/user_spec.rb
zz_bitbucket_rest_api-0.1.8 spec/bitbucket_rest_api/user_spec.rb
bitbucket_rest_api2-0.9.5 spec/bitbucket_rest_api/user_spec.rb