Sha256: 0c357d8137d75875c7aa8c44792d0d746383a3e00b3704f576dfa6d0dd84ea12
Contents?: true
Size: 1.48 KB
Versions: 12
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' require 'r10k/git' require 'r10k/git/stateful_repository' describe R10K::Git::StatefulRepository do let(:remote) { 'git://some.site/some-repo.git' } subject { described_class.new('0.9.x', remote, '/some/nonexistent/basedir', 'some-dirname') } describe "determining if the cache needs to be synced" do let(:cache) { double('cache') } before { expect(R10K::Git.cache).to receive(:generate).with(remote).and_return(cache) } it "is true if the cache is absent" do expect(cache).to receive(:exist?).and_return false expect(subject.sync_cache?).to eq true end it "is true if the ref is unresolvable" do expect(cache).to receive(:exist?).and_return true expect(cache).to receive(:resolve).with('0.9.x') expect(subject.sync_cache?).to eq true end it "is true if the ref is not a tag or commit" do expect(cache).to receive(:exist?).and_return true expect(cache).to receive(:resolve).with('0.9.x').and_return('93456ec7dc0f6fd3ac193b4df64f6544615dfbc9') expect(cache).to receive(:ref_type).with('0.9.x').and_return(:branch) expect(subject.sync_cache?).to eq true end it "is false otherwise" do expect(cache).to receive(:exist?).and_return true expect(cache).to receive(:resolve).with('0.9.x').and_return('93456ec7dc0f6fd3ac193b4df64f6544615dfbc9') expect(cache).to receive(:ref_type).with('0.9.x').and_return(:tag) expect(subject.sync_cache?).to eq false end end end
Version data entries
12 entries across 12 versions & 1 rubygems