Sha256: f5e5d986342d91effef5395be01d55296d2ffdd26cc584985a6e248e22c6a6db

Contents?: true

Size: 931 Bytes

Versions: 3

Compression:

Stored size: 931 Bytes

Contents

require "spec_helper"

describe CompareLinker::GithubLinkFinder do
  let(:octokit) { double.as_null_object }

  subject { described_class.new(octokit) }


  describe "#find" do
    before do
      allow(HTTPClient).to receive_message_chain(:get, :body).and_return load_fixture("rails.json")
    end

    it "extracts repo_owner and repo_name" do
      subject.find("rails")
      expect(subject.repo_owner).to eq "rails"
      expect(subject.repo_name).to eq "rails"
    end

    context "if github url includes trailing slash" do
      before do
        allow(HTTPClient).to receive_message_chain(:get, :body).and_return load_fixture("web_translate_it.json")
      end

      it "extracts repo_owner and repo_name without trailing slash" do
        subject.find("web_translate_it")
        expect(subject.repo_owner).to eq "atelierconvivialite"
        expect(subject.repo_name).to eq "webtranslateit"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
compare_linker-1.1.3 spec/lib/compare_linker/github_link_finder_spec.rb
compare_linker-1.1.2 spec/lib/compare_linker/github_link_finder_spec.rb
compare_linker-1.1.1 spec/lib/compare_linker/github_link_finder_spec.rb