<commit_before>require 'spec_helper.rb'

RSpec.describe Bitbucket::Client do
  include ApiResponseMacros

  let(:client) { Bitbucket::Client.new({}) }

  describe 'new' do
    let(:options) { {} }

    context 'without block' do
      subject { Bitbucket::Client.new(options) }
      it { expect(subject.config).to eq(options) }
    end

    context 'with block' do
      subject do
        Bitbucket::Client.new do |config|
          options.each_pair do |key, value|
            config.send("#{key}=", value)
          end
        end
      end
      it { expect(subject.config).to eq(options) }
    end
  end

  describe 'repos' do
    subject { client.repos }
    before { stub_apiresponse(:get, '/repositories') }
    it { expect(subject).to be_instance_of(Bitbucket::Models::Page) }
  end

  describe 'repo' do
    let(:owner) { 'test_owner' }
    let(:repo_slug) { 'test_repo' }
    let(:request_path) { "/repositories/#{owner}/#{repo_slug}" }

    before { stub_apiresponse(:get, request_path) }
    subject { client.repo(owner, repo_slug) }

    it { expect(subject).to be_instance_of(Bitbucket::Models::Repository) }
  end

  describe 'teams' do
    subject { client.teams }
    it { expect(subject).to be_instance_of(Bitbucket::Api::TeamsApi) }
  end

  describe 'users' do
    subject { client.users }
    it { expect(subject).to be_instance_of(Bitbucket::Api::UsersApi) }
  end<commit_msg>fix repo spec.<commit_after>require 'spec_helper.rb'

RSpec.describe Bitbucket::Client do
  include ApiResponseMacros

  let(:client) { Bitbucket::Client.new({}) }

  describe 'new' do
    let(:options) { {} }

    context 'without block' do
      subject { Bitbucket::Client.new(options) }
      it { expect(subject.config).to eq(options) }
    end

    context 'with block' do
      subject do
        Bitbucket::Client.new do |config|
          options.each_pair do |key, value|
            config.send("#{key}=", value)
          end
        end
      end
      it { expect(subject.config).to eq(options) }
    end
  end

  describe 'repos' do
    subject { client.repos }
    before { stub_apiresponse(:get, '/repositories') }
    it { expect(subject).to be_instance_of(Bitbucket::Models::Page) }
  end

  describe 'repo' do
    let(:repo_owner) { 'test_owner' }
    let(:repo_slug) { 'test_repo' }

    subject { client.repo(repo_owner, repo_slug) }

    it 'return RepoApi instance' do
      expect(subject).to be_instance_of(Bitbucket::Api::RepoApi)
      expect(subject.repo_owner).to eq(repo_owner)
      expect(subject.repo_slug).to eq(repo_slug)
    end
  end

  describe 'teams' do
    subject { client.teams }
    it { expect(subject).to be_instance_of(Bitbucket::Api::TeamsApi) }
  end

  describe 'users' do
    subject { client.users }
    it { expect(subject).to be_instance_of(Bitbucket::Api::UsersApi) }
  end
{'fraction_non_alphanumeric': 0.12963617096432356, 'fraction_numerical': 0.0, 'mean_word_length': 3.074820143884892, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4102746', 'n_tokens_mistral': 934, 'n_tokens_neox': 917, 'n_words': 195}