Sha256: e697d75e0608617ab5ae64d235f114cdec761c987ec1910f7e434f96180a0455

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe BitBucket::Repos::Changesets do
  let(:changesets) { BitBucket::Repos::Changesets.new }

  describe '.list' do
    before do
      expect(changesets).to receive(:request).with(
        :get,
        '/1.0/repositories/mock_username/mock_repo/changesets',
        {},
        {}
      ).and_return(%w[changset1 changeset2 changeset3])
    end

    context 'without a block' do
      it 'should send a GET request for the changesets belonging to the given repo' do
        changesets.list('mock_username', 'mock_repo')
      end
    end

    context 'with a block' do
      it 'should send a GET request for the changesets belonging to the given repo' do
        changesets.list('mock_username', 'mock_repo') { |changeset| changeset }
      end
    end
  end

  describe '.get' do
    before do
      expect(changesets).to receive(:request).with(
        :get,
        '/1.0/repositories/mock_username/mock_repo/changesets/test_sha',
        {},
        {}
      )
    end

    it 'should send a GET request for a particular changeset belonging to the given repo' do
      changesets.get('mock_username', 'mock_repo', 'test_sha')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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