Sha256: b40127818ff3818ab4031cf094d17cdb3295065f8adf6d073813aa86d90066f8

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

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

5 entries across 5 versions & 2 rubygems

Version Path
zz_bitbucket_rest_api-0.1.11 spec/bitbucket_rest_api/repos/following_spec.rb
zz_bitbucket_rest_api-0.1.10 spec/bitbucket_rest_api/repos/following_spec.rb
zz_bitbucket_rest_api-0.1.9 spec/bitbucket_rest_api/repos/following_spec.rb
zz_bitbucket_rest_api-0.1.8 spec/bitbucket_rest_api/repos/following_spec.rb
bitbucket_rest_api2-0.9.5 spec/bitbucket_rest_api/repos/following_spec.rb