Sha256: 86c4805925af6ce244a53e3c543203315e3477ef49c28701dcc66fee43dd1a3e

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require_relative "../../spec_helper"
require_relative "../../../lib/vendorise/arborist"

module Vendorise
  describe Arborist do
    let(:subtree_already_exists?) { false }

    before { allow(subject).to receive(:subtree_already_exists?).and_return(subtree_already_exists?) }

    context "when branch is specified in the constructor" do
      subject { Arborist.new "foo/bar", "git@github.com:New-Bamboo/vendorise.git", "development" }

      it "makes #subtree_command use that branch" do
        expect(subject.subtree_command).to eq "git subtree add --prefix foo/bar git@github.com:New-Bamboo/vendorise.git development --squash"
      end
    end

    describe :subtree_already_exists? do
      subject { Arborist.new "foo/bar", "git@github.com:New-Bamboo/vendorise.git", "master" }

      context "is false" do
        it "makes #subtree_command use 'git subtree add'" do
          expect(subject.subtree_command).to eq "git subtree add --prefix foo/bar git@github.com:New-Bamboo/vendorise.git master --squash"
        end
      end

      context "is true" do
        let(:subtree_already_exists?) { true }

        it "makes #subtree_command use 'git subtree pull'" do
          expect(subject.subtree_command).to eq "git subtree pull --prefix foo/bar git@github.com:New-Bamboo/vendorise.git master --squash"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vendorise-0.3.0 spec/lib/vendorise/arborist_spec.rb