Sha256: 08349799839bd6268c6d418199b55600f17440a489056e887c50f3ae6dc4c5c8

Contents?: true

Size: 1.46 KB

Versions: 6

Compression:

Stored size: 1.46 KB

Contents

require "spec_helper"

describe "Bundle with custom path" do
  let(:gem_name) { 'rack' }
  let(:path) { 'vendor/bundle' }

  shared_examples :gemfile_dependencies_are_satisfied do

    it 'installs gems in the --path directory' do
      build_gemfile <<-Gemfile
        source "https://rubygems.org"

        gem 'appraisal', :path => #{PROJECT_ROOT.inspect}
      Gemfile

      build_appraisal_file <<-Appraisals
        appraise "#{gem_name}" do
          gem '#{gem_name}'
        end
      Appraisals

      run %(bundle install --path="#{path}")
      run 'bundle exec appraisal install'

      installed_gem = Dir.glob("tmp/stage/#{path}/#{Gem.ruby_engine}/*/gems/*").
                      map    { |path| path.split('/').last }.
                      select { |gem| gem.include?(gem_name) }
      expect(installed_gem).not_to be_empty

      bundle_output = run 'bundle check'
      expect(bundle_output).to include("The Gemfile's dependencies are satisfied")

      appraisal_output = run 'bundle exec appraisal install'
      expect(appraisal_output).to include("The Gemfile's dependencies are satisfied")
    end
  end

  include_examples :gemfile_dependencies_are_satisfied

  context 'when already installed in vendor/another' do
    before do
      build_gemfile <<-Gemfile
        source "https://rubygems.org"

        gem '#{gem_name}'
      Gemfile

      run 'bundle install --path vendor/another'
    end

    include_examples :gemfile_dependencies_are_satisfied
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/appraisal-2.5.0/spec/acceptance/bundle_with_custom_path_spec.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/appraisal-2.5.0/spec/acceptance/bundle_with_custom_path_spec.rb
appraisal-2.5.0 spec/acceptance/bundle_with_custom_path_spec.rb
appraisal-2.4.1 spec/acceptance/bundle_with_custom_path_spec.rb
appraisal-2.4.0 spec/acceptance/bundle_with_custom_path_spec.rb
appraisal-2.3.0 spec/acceptance/bundle_with_custom_path_spec.rb