Sha256: b5eeeaf63ed556d45471f6a6695912ca62f97f782dcf10808c1f6f7186cdf011

Contents?: true

Size: 1.11 KB

Versions: 9

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe LintTrap::Container::Docker do
  subject(:container){described_class.new('lintci/spin_cycle:latest', '/local/path')}

  describe '#wrap' do
    it 'wraps the command passed in with a call to docker' do
      expect(container.wrap('ls')).to eq(
        'docker run --privileged=false '\
        "-v #{described_class::LOCAL_CONFIG_PATH}:/opt/lint_trap/config "\
        '-v /local/path:/home/spin_cycle '\
        '--workdir=/home/spin_cycle --user=spin_cycle lintci/spin_cycle:latest ls'
      )
    end
  end

  describe '#config_path' do
    it 'returns the docker config_path' do
      expect(container.config_path('')).to eq(described_class::CONFIG_PATH.to_s)
    end
  end

  describe '#container_path' do
    it 'returns the absolute path of the file in the container' do
      expect(container.container_path('/local/path/bad.file')).to eq('/home/spin_cycle/bad.file')
    end
  end

  describe '#local_path' do
    it 'returns the absolute path of the file outside the container' do
      expect(container.local_path('/home/spin_cycle/bad.file')).to eq('/local/path/bad.file')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lint_trap-0.0.11 spec/container/docker_spec.rb
lint_trap-0.0.10 spec/container/docker_spec.rb
lint_trap-0.0.9 spec/container/docker_spec.rb
lint_trap-0.0.8 spec/container/docker_spec.rb
lint_trap-0.0.7 spec/container/docker_spec.rb
lint_trap-0.0.6 spec/container/docker_spec.rb
lint_trap-0.0.5 spec/container/docker_spec.rb
lint_trap-0.0.4 spec/container/docker_spec.rb
lint_trap-0.0.3 spec/container/docker_spec.rb