Sha256: 49d3c1031ebb7670f0b81472501b84a66faca80e186f21f4b98ae6814464c809

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

# -*- coding: UTF-8 -*-

require 'spec_helper'

describe LitaGithub::Repo do
  include LitaGithub::Repo

  describe '::PR_LIST_MAX_COUNT' do
    subject { LitaGithub::Repo::PR_LIST_MAX_COUNT }

    it { should be_an_instance_of Fixnum }
    it { should eql 20 }
  end

  describe '.rpo' do
    it 'should return the provided arguments in a Repo-like string' do
      org = 'GrapeDuty'
      repo = 'lita-test'
      expect(rpo(org, repo)).to eql "#{org}/#{repo}"
    end
  end

  describe '.repo?' do
    before do
      @octo = double('Octokit::Client', repository?: true)
      allow(self).to receive(:octo).and_return(@octo)
    end

    context 'when repo exists' do
      subject { repo?('GrapeDuty/lita-test') }
      it { should be_truthy }
    end

    context 'when repo does not exist' do
      before do
        @octo = double('Octokit::Client', repository?: false)
        allow(self).to receive(:octo).and_return(@octo)
      end

      subject { repo?('GrapeDuty/lita-test') }
      it { should be_falsey }
    end
  end

  describe '.repo_match' do
    before { allow(self).to receive(:organization).and_return('GrapeDuty') }

    let(:resp_obj) do
      md_mock = { 'org' => 'GrapeDuty', 'repo' => 'lita-test' }
      double('Lita::Response', match_data: md_mock)
    end

    it 'should return the Org/Repo match' do
      expect(repo_match(resp_obj)).to eql ['GrapeDuty', 'lita-test']
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lita-github-0.0.8 spec/unit/lita-github/repo_spec.rb
lita-github-0.0.7 spec/unit/lita-github/repo_spec.rb
lita-github-0.0.6 spec/unit/lita-github/repo_spec.rb