Sha256: 38062953001feb56e0c59777d7fb6b6a6e24a8f8ded263a5ce7e9cd70a6a0127

Contents?: true

Size: 1.95 KB

Versions: 3

Compression:

Stored size: 1.95 KB

Contents

require "spec_helper"

describe "Bundle with custom path" do
  it "supports --path option" do
    build_gemfile <<-Gemfile
      source "https://rubygems.org"

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

    build_appraisal_file <<-Appraisals
      appraise "breakfast" do
      end
    Appraisals

    run %(bundle install --path="vendor/bundle")
    output = run "appraisal install"

    expect(file "gemfiles/breakfast.gemfile").to be_exists
    expect(output).to include("Successfully installed bundler")
  end

  context 'when already installed in vendor/another' do
    let(:gem_name) { 'rack' }
    let(:path) { 'vendor/bundle' }

    before do
      build_gemfile <<-Gemfile
        source "https://rubygems.org"

        gem '#{gem_name}'
      Gemfile

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

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

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

        if RUBY_VERSION < "1.9"
          #{File.read(File.join(PROJECT_ROOT, "Gemfile-1.8"))}
        elsif RUBY_VERSION < "2.2"
          #{File.read(File.join(PROJECT_ROOT, "Gemfile-2.1"))}
        end
      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}/ruby/*/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
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/appraisal-2.2.0/spec/acceptance/bundle_with_custom_path_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/appraisal-2.2.0/spec/acceptance/bundle_with_custom_path_spec.rb
appraisal-2.2.0 spec/acceptance/bundle_with_custom_path_spec.rb