File: cache_spec.rb

package info (click to toggle)
r10k 5.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,228 kB
  • sloc: ruby: 18,180; makefile: 10; sh: 1
file content (33 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'spec_helper'
require 'r10k/git/rugged/cache'

describe R10K::Git::Rugged::Cache, :if => R10K::Features.available?(:rugged) do
  include_context 'Git integration'

  let(:dirname) { 'working-repo' }
  let(:remote_name) { 'origin' }

  subject { described_class.new(remote) }

  context "syncing with the remote" do
    before(:each) do
      subject.reset!
    end

    describe "with the correct configuration" do
      it "is able to sync with the remote" do
        subject.sync
        expect(subject.synced?).to eq(true)
      end
    end

    describe "with a out of date cached remote" do
      it "updates the cached remote configuration" do
        subject.repo.update_remote('foo', remote_name)
        expect(subject.repo.remotes[remote_name]).to eq('foo')
        subject.sync
        expect(subject.repo.remotes[remote_name]).to eq(remote)
      end
    end
  end
end