Sha256: 20c1b3fcbe11d2f1d33d481cfbb2f18152682981a8726bbf3f4b2d3ebbff6838

Contents?: true

Size: 956 Bytes

Versions: 8

Compression:

Stored size: 956 Bytes

Contents

require 'spec_helper'

describe Ghit::RemoteExtracter do
  let(:raw_origin) { "origin\tgit@github.com:author/name.git (fetch)\norigin\tgit@github.com:author/name.git (push)\n" }
  let(:raw_github) { "github\tgit@github.com:author/name.git (fetch)\ngithub\tgit@github.com:author/name.git (push)\n" }

  it "extracts the 'origin' remote" do
    expect(described_class).to receive(:`).and_return raw_origin
    expect(described_class.extract!).to eq "origin\tgit@github.com:author/name.git (fetch)"
  end

  it 'raises an error if there are no remotes for current repo' do
    expect(described_class).to receive(:`).and_return("")
    expect{
      described_class.extract!
    }.to raise_error Ghit::Errors::NoRemotesFound
  end

  it 'raises an error if theres no remote named "origin"' do
    expect(described_class).to receive(:`).and_return raw_github
    expect{
      described_class.extract!
    }.to raise_error Ghit::Errors::NoOriginRemote
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ghit-0.2.4 spec/remote_extracter_spec.rb
ghit-0.2.3 spec/remote_extracter_spec.rb
ghit-0.2.2 spec/remote_extracter_spec.rb
ghit-0.2.1 spec/remote_extracter_spec.rb
ghit-0.2.0 spec/remote_extracter_spec.rb
ghit-0.1.0 spec/remote_extracter_spec.rb
ghit-0.0.2 spec/remote_extracter_spec.rb
ghit-0.0.1 spec/remote_extracter_spec.rb