Sha256: 7c9a863f9b9285d2b1fe612640abde8ab04bcc70a7bb62acd2bc2ac64088d8ef

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe BitBucket::Repos::DefaultReviewers do
  subject { described_class.new }
  describe '#list' do
    before do
      expect(subject).to receive(:request).with(
        :get,
        '/2.0/repositories/mock_user/mock_repo/default-reviewers',
        {},
        {}
      )
    end

    it 'makes a GET request for all default reviewers belonging to the repo' do
      subject.list('mock_user', 'mock_repo')
    end
  end

  describe '#get' do
    before do
      expect(subject).to receive(:request).with(
        :get,
        '/2.0/repositories/mock_user/mock_repo/default-reviewers/mock_reviewer',
        {},
        {}
      )
    end

    it 'makes a GET request for a default reviewer by username' do
      subject.get('mock_user', 'mock_repo', 'mock_reviewer')
    end
  end

  describe '#add' do
    before do
      expect(subject).to receive(:request).with(
        :put,
        '/2.0/repositories/mock_user/mock_repo/default-reviewers/mock_reviewer',
        {},
        {}
      )
    end

    it 'makes a PUT request to add the new reviewer to the default reviewers list' do
      subject.add('mock_user', 'mock_repo', 'mock_reviewer')
    end
  end

  describe '#remove' do
    before do
      expect(subject).to receive(:request).with(
        :delete,
        '/2.0/repositories/mock_user/mock_repo/default-reviewers/mock_reviewer',
        {},
        {}
      )
    end

    it 'makes a DELETE request to remove a reviewer from the list' do
      subject.remove('mock_user', 'mock_repo', 'mock_reviewer')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitbuckets-0.2.0 spec/bitbucket_rest_api/repos/default_reviewers_spec.rb