Sha256: f0605e334c9089dedf1a9bf2c4e2be8e514ca965107497e0f748a9c213ec3e0a

Contents?: true

Size: 1.03 KB

Versions: 246

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

246 entries across 246 versions & 3 rubygems

Version Path
eac_tools-0.76.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.76.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.75.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.75.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.75.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.74.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.74.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.73.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.72.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.70.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.70.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.69.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.69.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.68.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.67.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.67.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.66.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.65.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.65.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb
eac_tools-0.64.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb