Sha256: b9e0dee9eddc526a4452677670d0242198a8916c338094a11798d381972d35ab

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe BitBucket::Repos::Following do
  let(:following) { BitBucket::Repos::Following.new }

  describe '.followers' do
    before do
      expect(following).to receive(:request).with(
        :get,
        '/1.0/repositories/mock_username/mock_repo/followers/',
        {},
        {}
      ).and_return(%w[follower1 follower2 follower3])
    end

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

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

  # TODO: implement this method in the User class where it belongs
  describe '.followed' do
    before do
      expect(following).to receive(:request).with(
        :get,
        '/1.0/user/follows',
        {},
        {}
      ).and_return(%w[followed1 followed2 followed3])
    end

    context 'without a block' do
      it 'should send a GET request for the followers belonging to a particular user' do
        following.followed
      end
    end

    context 'with a block' do
      it 'should send a GET request for the followers belonging to a particular user' do
        following.followed { |followed| followed }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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