Sha256: 0f273c5f32a20e9cb0518f4817c80dc1fd467357fce2a6b7887765f0597ce9d4

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe BitBucket::Repos::Components do
  subject { described_class.new }
  describe '#list' do
    before do
      expect(subject).to receive(:request).with(
        :get,
        '/2.0/repositories/mock_user/mock_repo/components',
        {},
        {}
      ).and_return('values' => %w[component1 component2 component3])
    end

    context 'without a block' do
      it 'makes a GET request for all components defined in the issue tracker' do
        subject.list('mock_user', 'mock_repo')
      end
    end

    context 'with a block' do
      it 'makes a GET request for all components defined in the issue tracker' do
        subject.list('mock_user', 'mock_repo') { |component| component }
      end
    end
  end

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

    it 'makes a GET request for all components defined in the issue tracker' do
      subject.get('mock_user', 'mock_repo', 1)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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