Sha256: 78048aae27bc2f389774b3943b962f11ce68b73055d6a4ca4fbfcc4b288ceb52

Contents?: true

Size: 1.11 KB

Versions: 48

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'
require 'r10k/git/cache'

describe R10K::Git::Cache do

  let(:subclass) do
    Class.new(described_class) do
      def self.bare_repository
        Class.new { def initialize(*args) end }
      end
    end
  end

  subject { subclass.new('git://some/git/remote') }

  describe "updating the cache" do
    it "only updates the cache once" do
      expect(subject).to receive(:sync!).exactly(1).times
      subject.sync
      subject.sync
    end
  end

  describe "methods on the repository" do
    def expect_delegation(method)
      expect(subject.repo).to receive(method)
      subject.send(method)
    end

    it "delegates #git_dir" do
      expect_delegation(:git_dir)
    end

    it "delegates #objects_dir" do
      expect_delegation(:objects_dir)
    end

    it "delegates #branches" do
      expect_delegation(:branches)
    end

    it "delegates #tags" do
      expect_delegation(:tags)
    end

    it "delegates #exist?" do
      expect_delegation(:exist?)
    end

    it "aliases #cached? to #exist?" do
      expect(subject.repo).to receive(:exist?)
      subject.cached?
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
r10k-3.6.0 spec/unit/git/cache_spec.rb
r10k-2.6.9 spec/unit/git/cache_spec.rb
r10k-3.5.2 spec/unit/git/cache_spec.rb
r10k-3.5.1 spec/unit/git/cache_spec.rb
r10k-3.5.0 spec/unit/git/cache_spec.rb
r10k-3.4.1 spec/unit/git/cache_spec.rb
r10k-2.6.8 spec/unit/git/cache_spec.rb
r10k-3.4.0 spec/unit/git/cache_spec.rb
r10k-3.3.3 spec/unit/git/cache_spec.rb
r10k-3.2.3 spec/unit/git/cache_spec.rb
r10k-2.6.7 spec/unit/git/cache_spec.rb
r10k-3.3.2 spec/unit/git/cache_spec.rb
r10k-3.3.1 spec/unit/git/cache_spec.rb
r10k-3.2.1 spec/unit/git/cache_spec.rb
r10k-3.0.4 spec/unit/git/cache_spec.rb
r10k-2.6.6 spec/unit/git/cache_spec.rb
r10k-3.3.0 spec/unit/git/cache_spec.rb
r10k-3.2.0 spec/unit/git/cache_spec.rb
r10k-3.1.1 spec/unit/git/cache_spec.rb
r10k-3.1.0 spec/unit/git/cache_spec.rb