Sha256: d51d46c73a7a08e59f3dbd2007991eccc05bea09bdef32bc1f44626d7e89a3e6

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

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' => ['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

4 entries across 4 versions & 1 rubygems

Version Path
zz_bitbucket_rest_api-0.1.11 spec/bitbucket_rest_api/repos/components_spec.rb
zz_bitbucket_rest_api-0.1.10 spec/bitbucket_rest_api/repos/components_spec.rb
zz_bitbucket_rest_api-0.1.9 spec/bitbucket_rest_api/repos/components_spec.rb
zz_bitbucket_rest_api-0.1.8 spec/bitbucket_rest_api/repos/components_spec.rb