Sha256: c47797756f4932fa405397e7f6eebcd21e6d9d0b32a83c59391d2024416c5db8

Contents?: true

Size: 1.61 KB

Versions: 14

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'

describe 'CLI appraisal (with arguments)' do
  before do
    build_appraisal_file <<-Appraisal
      appraise '1.0.0' do
        gem 'dummy', '1.0.0'
      end

      appraise '1.1.0' do
        gem 'dummy', '1.1.0'
      end
    Appraisal

    run 'appraisal install'
    write_file 'test.rb', 'puts "Running: #{$dummy_version}"'
    write_file 'test with spaces.rb', 'puts "Running: #{$dummy_version}"'
  end

  it 'sets APPRAISAL_INITIALIZED environment variable' do
    write_file 'test.rb', <<-TEST_FILE.strip_heredoc
      if ENV['APPRAISAL_INITIALIZED']
        puts "Appraisal initialized!"
      end
    TEST_FILE

    output = run 'appraisal 1.0.0 ruby -rbundler/setup -rdummy test.rb'
    expect(output).to include 'Appraisal initialized!'
  end

  context 'with appraisal name' do
    it 'runs the given command against a correct versions of dependency' do
      output = run 'appraisal 1.0.0 ruby -rbundler/setup -rdummy test.rb'

      expect(output).to include 'Running: 1.0.0'
      expect(output).not_to include 'Running: 1.1.0'
    end
  end

  context 'without appraisal name' do
    it 'runs the given command against all versions of dependency' do
      output = run 'appraisal ruby -rbundler/setup -rdummy test.rb'

      expect(output).to include 'Running: 1.0.0'
      expect(output).to include 'Running: 1.1.0'
    end
  end

  context 'when one of the arguments contains spaces' do
    it 'preserves those spaces' do
      command = 'appraisal 1.0.0 ruby -rbundler/setup -rdummy "test with spaces.rb"'
      output = run(command)
      expect(output).to include 'Running: 1.0.0'
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/appraisal-2.5.0/spec/acceptance/cli/run_spec.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/appraisal-2.5.0/spec/acceptance/cli/run_spec.rb
appraisal-2.5.0 spec/acceptance/cli/run_spec.rb
appraisal-2.4.1 spec/acceptance/cli/run_spec.rb
appraisal-2.4.0 spec/acceptance/cli/run_spec.rb
appraisal-2.3.0 spec/acceptance/cli/run_spec.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/appraisal-2.2.0/spec/acceptance/cli/run_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/appraisal-2.2.0/spec/acceptance/cli/run_spec.rb
appraisal-2.2.0 spec/acceptance/cli/run_spec.rb
appraisal-2.1.0 spec/acceptance/cli/run_spec.rb
appraisal-2.0.2 spec/acceptance/cli/run_spec.rb
appraisal-2.0.1 spec/acceptance/cli/run_spec.rb
appraisal-2.0.0 spec/acceptance/cli/run_spec.rb
appraisal-1.0.3 spec/acceptance/cli/run_spec.rb