Sha256: eba9aa8c8a89a827d7dc12dd0f9d96abd0aa5eafa26d3d4dbabb85dd8f49cf84

Contents?: true

Size: 973 Bytes

Versions: 5

Compression:

Stored size: 973 Bytes

Contents

require 'spec_helper'

describe LintTrap::Command do
  let(:file){fixture_path('lint.txt')}
  let(:command){described_class.new('cat', %w(-b), [file])}
  let(:container){LintTrap::Container::Docker.new('lintci/rubocop', fixture_path)}

  describe '#run' do
    let(:container){LintTrap::Container::Docker.new('lintci/rubocop', fixture_path, remove_container: ENV['CI'].nil?)}

    it 'generates the expected output' do
      success = command.run(container) do |io|
        expect(io.read).to eq("     1\tlint\n")
      end

      expect(success).to be_truthy
    end
  end

  describe '#command/#to_s' do
    it 'generates a wrapped executable command' do
      expect(command.to_s(container)).to eq(
        'docker run --rm --net="none" --privileged=false '\
        "-v #{LintTrap::Container::Base::LOCAL_CONFIG_PATH}:/config "\
        "-v #{fixture_path}:/src --workdir=/src --user=lint_trap lintci/rubocop "\
        'cat -b /src/lint.txt'
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lint_trap-0.0.18 spec/command_spec.rb
lint_trap-0.0.17 spec/command_spec.rb
lint_trap-0.0.16 spec/command_spec.rb
lint_trap-0.0.15 spec/command_spec.rb
lint_trap-0.0.14 spec/command_spec.rb