Sha256: ae7630c079d1a20b3e6dcee29a7a6d89ca9baa6c97b9220e13f5631f3e55e4eb

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/envs/executable'
require 'eac_ruby_utils/envs/local_env'

RSpec.describe ::EacRubyUtils::Envs::Executable do
  let(:env) { ::EacRubyUtils::Envs::LocalEnv.new }
  context 'when program exist' do
    let(:instance) { described_class.new(env, 'cat', '--version') }

    it { expect(instance.exist?).to eq(true) }
    it { expect { instance.validate! }.not_to raise_error }
    it { expect(instance.validate).to be_blank }
    it { expect(instance.command).to be_a(::EacRubyUtils::Envs::Command) }
  end

  context 'when program does not exist' do
    let(:instance) { described_class.new(env, 'this_cannot_exist', '--version') }

    it { expect(instance.exist?).to eq(false) }
    it {
      expect { instance.validate! }.to raise_error(
        described_class.const_get('ProgramNotFoundError')
      )
    }
    it { expect(instance.validate).to be_present }
    it {
      expect { instance.command }.to raise_error(
        described_class.const_get('ProgramNotFoundError')
      )
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ehbrs-tools-0.11.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
ehbrs-tools-0.10.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
ehbrs-tools-0.9.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
ehbrs-tools-0.7.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
ehbrs-tools-0.6.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
ehbrs-tools-0.5.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
ehbrs-tools-0.3.1 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
ehbrs-tools-0.3.0 vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb