Sha256: 9a2c8ce36b25e6dcc213886669a93e72253e09588f6cfb3ee7d707496fba81e8

Contents?: true

Size: 919 Bytes

Versions: 72

Compression:

Stored size: 919 Bytes

Contents

require 'spec_helper'
require 'r10k/source'

describe R10K::Source::Base do
  subject { described_class.new('base', '/some/nonexistent/path') }

  describe "accepting a visitor" do
    it "passes itself to the visitor" do
      visitor = spy('visitor')
      expect(visitor).to receive(:visit).with(:source, subject)
      subject.accept(visitor)
    end

    it "passes the visitor to each environment if the visitor yields" do
      visitor = spy('visitor')
      expect(visitor).to receive(:visit) do |type, other, &block|
        expect(type).to eq :source
        expect(other).to eq subject
        block.call
      end

      env1 = spy('environment')
      expect(env1).to receive(:accept).with(visitor)
      env2 = spy('environment')
      expect(env2).to receive(:accept).with(visitor)

      expect(subject).to receive(:environments).and_return([env1, env2])
      subject.accept(visitor)
    end
  end
end

Version data entries

72 entries across 72 versions & 2 rubygems

Version Path
r10k-3.15.0 spec/unit/source/base_spec.rb
akerl-r10k-3.14.2.1 spec/unit/source/base_spec.rb
r10k-3.14.2 spec/unit/source/base_spec.rb
r10k-3.14.1 spec/unit/source/base_spec.rb
r10k-3.14.0 spec/unit/source/base_spec.rb
r10k-3.13.0 spec/unit/source/base_spec.rb
r10k-3.12.1 spec/unit/source/base_spec.rb
r10k-3.12.0 spec/unit/source/base_spec.rb
r10k-3.11.0 spec/unit/source/base_spec.rb
r10k-3.10.0 spec/unit/source/base_spec.rb
r10k-3.9.3 spec/unit/source/base_spec.rb
r10k-3.9.2 spec/unit/source/base_spec.rb
r10k-3.9.1 spec/unit/source/base_spec.rb
r10k-3.9.0 spec/unit/source/base_spec.rb
r10k-3.8.0 spec/unit/source/base_spec.rb
r10k-3.7.0 spec/unit/source/base_spec.rb
r10k-3.6.0 spec/unit/source/base_spec.rb
r10k-2.6.9 spec/unit/source/base_spec.rb
r10k-3.5.2 spec/unit/source/base_spec.rb
r10k-3.5.1 spec/unit/source/base_spec.rb