2018-11-03 02:07:56 +03:00
# frozen_string_literal: true
RSpec . describe " bundle binstubs <gem> " do
context " when the gem exists in the lockfile " do
it " sets up the binstub " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
bundle " binstubs rack "
expect ( bundled_app ( " bin/rackup " ) ) . to exist
end
it " does not install other binstubs " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
gem " rails "
G
bundle " binstubs rails "
expect ( bundled_app ( " bin/rackup " ) ) . not_to exist
expect ( bundled_app ( " bin/rails " ) ) . to exist
end
it " does install multiple binstubs " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
gem " rails "
G
bundle " binstubs rails rack "
expect ( bundled_app ( " bin/rackup " ) ) . to exist
expect ( bundled_app ( " bin/rails " ) ) . to exist
end
it " allows installing all binstubs " do
2020-06-03 21:46:03 +03:00
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rails "
G
2020-06-03 21:45:36 +03:00
bundle :binstubs , :all = > true
2018-11-03 02:07:56 +03:00
expect ( bundled_app ( " bin/rails " ) ) . to exist
expect ( bundled_app ( " bin/rake " ) ) . to exist
end
2020-12-08 10:36:29 +03:00
it " allows installing binstubs for all platforms " do
install_gemfile <<-G
source " #{ file_uri_for ( gem_repo1 ) } "
gem " rack "
G
bundle " binstubs rack --all-platforms "
expect ( bundled_app ( " bin/rackup " ) ) . to exist
expect ( bundled_app ( " bin/rackup.cmd " ) ) . to exist
end
2018-11-03 02:07:56 +03:00
it " displays an error when used without any gem " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
2020-06-03 19:43:17 +03:00
bundle " binstubs " , :raise_on_error = > false
2020-06-24 20:53:16 +03:00
expect ( exitstatus ) . to eq ( 1 )
2019-04-14 09:01:35 +03:00
expect ( err ) . to include ( " `bundle binstubs` needs at least one gem to run. " )
2018-11-03 02:07:56 +03:00
end
it " displays an error when used with --all and gems " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
2020-06-03 19:43:17 +03:00
bundle " binstubs rack " , :all = > true , :raise_on_error = > false
2018-11-03 02:07:56 +03:00
expect ( last_command ) . to be_failure
2019-06-01 12:49:40 +03:00
expect ( err ) . to include ( " Cannot specify --all with specific gems " )
2018-11-03 02:07:56 +03:00
end
context " when generating bundle binstub outside bundler " do
it " should abort " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
bundle " binstubs rack "
2020-05-08 08:19:04 +03:00
File . open ( bundled_app ( " bin/bundle " ) , " wb " ) do | file |
2018-11-03 02:07:56 +03:00
file . print " OMG "
end
2020-06-03 19:43:17 +03:00
sys_exec " bin/rackup " , :raise_on_error = > false
2018-11-03 02:07:56 +03:00
2019-06-01 12:49:40 +03:00
expect ( err ) . to include ( " was not generated by Bundler " )
2018-11-03 02:07:56 +03:00
end
end
context " the bundle binstub " do
before do
2020-05-15 15:31:12 +03:00
pristine_system_gems " bundler- #{ system_bundler_version } "
2018-11-03 02:07:56 +03:00
build_repo2 do
2020-12-08 10:36:29 +03:00
build_gem " rack " , " 1.2 " do | s |
s . executables = " rackup "
end
2018-11-03 02:07:56 +03:00
build_gem " prints_loaded_gems " , " 1.0 " do | s |
s . executables = " print_loaded_gems "
s . bindir = " exe "
s . write " exe/print_loaded_gems " , <<-R
2021-10-11 20:58:24 +03:00
specs = Gem . loaded_specs . values . reject { | s | s . default_gem? }
2018-11-03 02:07:56 +03:00
puts specs . map ( & :full_name ) . sort . inspect
R
end
end
2020-06-03 21:46:03 +03:00
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo2 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
gem " prints_loaded_gems "
G
2020-06-03 21:45:36 +03:00
bundle " binstubs bundler rack prints_loaded_gems "
2018-11-03 02:07:56 +03:00
end
2019-04-14 09:01:35 +03:00
let ( :system_bundler_version ) { Bundler :: VERSION }
2018-11-03 02:07:56 +03:00
2019-04-14 09:01:35 +03:00
it " runs bundler " do
2020-06-03 21:46:35 +03:00
sys_exec " bin/bundle install " , :env = > { " DEBUG " = > " 1 " }
2020-05-08 08:19:04 +03:00
expect ( out ) . to include %( Using bundler #{ system_bundler_version } \n )
2018-11-03 02:07:56 +03:00
end
context " when BUNDLER_VERSION is set " do
it " runs the correct version of bundler " do
2020-06-03 19:43:17 +03:00
sys_exec " bin/bundle install " , :env = > { " BUNDLER_VERSION " = > " 999.999.999 " } , :raise_on_error = > false
2020-06-24 20:53:16 +03:00
expect ( exitstatus ) . to eq ( 42 )
2021-07-22 12:35:15 +03:00
expect ( err ) . to include ( " Activating bundler (999.999.999) failed: " ) .
and include ( " To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'` " )
end
it " runs the correct version of bundler even if a higher version is installed " do
system_gems " bundler-999.999.998 " , " bundler-999.999.999 "
sys_exec " bin/bundle install " , :env = > { " BUNDLER_VERSION " = > " 999.999.998 " , " DEBUG " = > " 1 " } , :raise_on_error = > false
expect ( out ) . to include %( Using bundler 999.999.998 \n )
2018-11-03 02:07:56 +03:00
end
end
context " when a lockfile exists with a locked bundler version " do
2019-11-13 01:57:02 +03:00
context " and the version is newer " do
before do
lockfile lockfile . gsub ( system_bundler_version , " 999.999 " )
end
it " runs the correct version of bundler " do
2020-06-03 19:43:17 +03:00
sys_exec " bin/bundle install " , :raise_on_error = > false
2020-06-24 20:53:16 +03:00
expect ( exitstatus ) . to eq ( 42 )
2019-11-13 01:57:02 +03:00
expect ( err ) . to include ( " Activating bundler (~> 999.999) failed: " ) .
and include ( " To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'` " )
end
2018-11-03 02:07:56 +03:00
end
2023-02-27 15:02:23 +03:00
context " and the version is newer when given `gems.rb` and `gems.locked` " do
before do
gemfile bundled_app ( " gems.rb " ) , gemfile
lockfile bundled_app ( " gems.locked " ) , lockfile . gsub ( system_bundler_version , " 999.999 " )
end
it " runs the correct version of bundler " do
sys_exec " bin/bundle install " , :env = > { " BUNDLE_GEMFILE " = > " gems.rb " } , :raise_on_error = > false
expect ( exitstatus ) . to eq ( 42 )
expect ( err ) . to include ( " Activating bundler (~> 999.999) failed: " ) .
and include ( " To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'` " )
end
end
2019-11-13 01:57:02 +03:00
context " and the version is older and a different major " do
let ( :system_bundler_version ) { " 55 " }
before do
lockfile lockfile . gsub ( / BUNDLED WITH \ n .*$ /m , " BUNDLED WITH \n 44.0 " )
end
it " runs the correct version of bundler " do
2020-06-03 19:43:17 +03:00
sys_exec " bin/bundle install " , :raise_on_error = > false
2020-06-24 20:53:16 +03:00
expect ( exitstatus ) . to eq ( 42 )
2019-11-13 01:57:02 +03:00
expect ( err ) . to include ( " Activating bundler (~> 44.0) failed: " ) .
and include ( " To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'` " )
end
2018-11-03 02:07:56 +03:00
end
2023-02-27 15:02:23 +03:00
context " and the version is older and a different major when given `gems.rb` and `gems.locked` " do
let ( :system_bundler_version ) { " 55 " }
before do
gemfile bundled_app ( " gems.rb " ) , gemfile
lockfile bundled_app ( " gems.locked " ) , lockfile . gsub ( / BUNDLED WITH \ n .*$ /m , " BUNDLED WITH \n 44.0 " )
end
it " runs the correct version of bundler " do
sys_exec " bin/bundle install " , :env = > { " BUNDLE_GEMFILE " = > " gems.rb " } , :raise_on_error = > false
expect ( exitstatus ) . to eq ( 42 )
expect ( err ) . to include ( " Activating bundler (~> 44.0) failed: " ) .
and include ( " To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'` " )
end
end
2019-11-13 01:57:02 +03:00
context " and the version is older and the same major " do
2022-01-31 19:45:12 +03:00
let ( :system_bundler_version ) { " 2.999.999 " }
2019-11-13 01:57:02 +03:00
before do
2021-12-27 03:41:55 +03:00
lockfile lockfile . gsub ( / BUNDLED WITH \ n .*$ /m , " BUNDLED WITH \n 2.3.0 " )
2021-12-21 08:50:44 +03:00
end
2023-01-10 07:53:41 +03:00
it " installs and runs the exact version of bundler " , :rubygems = > " >= 3.3.0.dev " , :realworld = > true do
2021-12-27 03:41:55 +03:00
sys_exec " bin/bundle install --verbose " , :artifice = > " vcr "
2021-12-21 08:50:44 +03:00
expect ( exitstatus ) . not_to eq ( 42 )
2022-01-31 19:45:12 +03:00
expect ( out ) . to include ( " Bundler 2.999.999 is running, but your lockfile was generated with 2.3.0. Installing Bundler 2.3.0 and restarting using that version. " )
2021-12-27 03:41:55 +03:00
expect ( out ) . to include ( " Using bundler 2.3.0 " )
expect ( err ) . not_to include ( " Activating bundler (~> 2.3.0) failed: " )
2019-11-13 01:57:02 +03:00
end
2021-12-21 08:50:44 +03:00
it " runs the available version of bundler " , :rubygems = > " < 3.3.0.dev " do
sys_exec " bin/bundle install --verbose "
2020-06-24 20:53:16 +03:00
expect ( exitstatus ) . not_to eq ( 42 )
2022-01-31 19:45:12 +03:00
expect ( out ) . not_to include ( " Bundler 2.999.999 is running, but your lockfile was generated with 2.3.0. Installing Bundler 2.3.0 and restarting using that version. " )
expect ( out ) . to include ( " Using bundler 2.999.999 " )
2021-12-27 03:41:55 +03:00
expect ( err ) . not_to include ( " Activating bundler (~> 2.3.0) failed: " )
2019-11-13 01:57:02 +03:00
end
2019-07-16 12:52:14 +03:00
end
2019-11-13 01:57:02 +03:00
context " and the version is a pre-releaser " do
let ( :system_bundler_version ) { " 55 " }
before do
lockfile lockfile . gsub ( / BUNDLED WITH \ n .*$ /m , " BUNDLED WITH \n 2.12.0.a " )
end
it " runs the correct version of bundler when the version is a pre-release " do
2020-06-03 19:43:17 +03:00
sys_exec " bin/bundle install " , :raise_on_error = > false
2020-06-24 20:53:16 +03:00
expect ( exitstatus ) . to eq ( 42 )
2019-11-13 01:57:02 +03:00
expect ( err ) . to include ( " Activating bundler (~> 2.12.a) failed: " ) .
and include ( " To install the version of bundler this project requires, run `gem install bundler -v '~> 2.12.a'` " )
end
2018-11-03 02:07:56 +03:00
end
end
context " when update --bundler is called " do
before { lockfile . gsub ( system_bundler_version , " 1.1.1 " ) }
2023-01-10 07:53:41 +03:00
it " calls through to the latest bundler version " , :realworld do
2020-06-03 21:46:35 +03:00
sys_exec " bin/bundle update --bundler " , :env = > { " DEBUG " = > " 1 " }
2022-03-21 17:36:51 +03:00
using_bundler_line = / Using bundler ([ \ w \ .]+) \ n / . match ( out )
expect ( using_bundler_line ) . to_not be_nil
latest_version = using_bundler_line [ 1 ]
expect ( Gem :: Version . new ( latest_version ) ) . to be > = Gem :: Version . new ( system_bundler_version )
2018-11-03 02:07:56 +03:00
end
it " calls through to the explicit bundler version " do
2020-06-03 19:43:17 +03:00
sys_exec " bin/bundle update --bundler=999.999.999 " , :raise_on_error = > false
2020-06-24 20:53:16 +03:00
expect ( exitstatus ) . to eq ( 42 )
2021-07-22 12:35:15 +03:00
expect ( err ) . to include ( " Activating bundler (999.999.999) failed: " ) .
and include ( " To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'` " )
2018-11-03 02:07:56 +03:00
end
end
context " without a lockfile " do
it " falls back to the latest installed bundler " do
2020-05-08 08:19:04 +03:00
FileUtils . rm bundled_app_lock
2020-06-03 21:46:35 +03:00
sys_exec " bin/bundle install " , :env = > { " DEBUG " = > " 1 " }
2020-05-08 08:19:04 +03:00
expect ( out ) . to include " Using bundler #{ system_bundler_version } \n "
2018-11-03 02:07:56 +03:00
end
end
context " using another binstub " do
it " loads all gems " do
2020-06-03 21:46:35 +03:00
sys_exec bundled_app ( " bin/print_loaded_gems " ) . to_s
2019-04-14 09:01:35 +03:00
expect ( out ) . to eq %( ["bundler- #{ Bundler :: VERSION } ", "prints_loaded_gems-1.0", "rack-1.2"] )
2018-11-03 02:07:56 +03:00
end
context " when requesting a different bundler version " do
before { lockfile lockfile . gsub ( Bundler :: VERSION , " 999.999.999 " ) }
2019-04-14 09:05:27 +03:00
it " attempts to load that version " do
2020-06-03 19:43:17 +03:00
sys_exec bundled_app ( " bin/rackup " ) . to_s , :raise_on_error = > false
2020-06-24 20:53:16 +03:00
expect ( exitstatus ) . to eq ( 42 )
2019-07-16 14:34:57 +03:00
expect ( err ) . to include ( " Activating bundler (~> 999.999) failed: " ) .
and include ( " To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'` " )
2018-11-03 02:07:56 +03:00
end
end
end
end
it " installs binstubs from git gems " do
FileUtils . mkdir_p ( lib_path ( " foo/bin " ) )
FileUtils . touch ( lib_path ( " foo/bin/foo " ) )
build_git " foo " , " 1.0 " , :path = > lib_path ( " foo " ) do | s |
s . executables = %w[ foo ]
end
install_gemfile <<-G
2021-07-24 18:27:02 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " foo " , :git = > " #{ lib_path ( " foo " ) } "
G
bundle " binstubs foo "
expect ( bundled_app ( " bin/foo " ) ) . to exist
end
it " installs binstubs from path gems " do
FileUtils . mkdir_p ( lib_path ( " foo/bin " ) )
FileUtils . touch ( lib_path ( " foo/bin/foo " ) )
build_lib " foo " , " 1.0 " , :path = > lib_path ( " foo " ) do | s |
s . executables = %w[ foo ]
end
install_gemfile <<-G
2021-07-24 18:27:02 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " foo " , :path = > " #{ lib_path ( " foo " ) } "
G
bundle " binstubs foo "
expect ( bundled_app ( " bin/foo " ) ) . to exist
end
it " sets correct permissions for binstubs " do
with_umask ( 0 o002 ) do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
bundle " binstubs rack "
binary = bundled_app ( " bin/rackup " )
2021-08-05 10:53:02 +03:00
expect ( File . stat ( binary ) . mode . to_s ( 8 ) ) . to eq ( Gem . win_platform? ? " 100644 " : " 100775 " )
2018-11-03 02:07:56 +03:00
end
end
context " when using --shebang " do
2019-08-09 19:56:40 +03:00
it " sets the specified shebang for the binstub " do
2018-11-03 02:07:56 +03:00
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
bundle " binstubs rack --shebang jruby "
2020-06-18 05:26:13 +03:00
expect ( File . readlines ( bundled_app ( " bin/rackup " ) ) . first ) . to eq ( " # !/usr/bin/env jruby \n " )
2018-11-03 02:07:56 +03:00
end
end
end
context " when the gem doesn't exist " do
it " displays an error with correct status " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
G
2020-06-03 19:43:17 +03:00
bundle " binstubs doesnt_exist " , :raise_on_error = > false
2018-11-03 02:07:56 +03:00
2020-06-24 20:53:16 +03:00
expect ( exitstatus ) . to eq ( 7 )
2019-04-14 09:01:35 +03:00
expect ( err ) . to include ( " Could not find gem 'doesnt_exist'. " )
2018-11-03 02:07:56 +03:00
end
end
context " --path " do
it " sets the binstubs dir " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
bundle " binstubs rack --path exec "
expect ( bundled_app ( " exec/rackup " ) ) . to exist
end
2019-01-04 16:10:58 +03:00
it " setting is saved for bundle install " , :bundler = > " < 3 " do
2018-11-03 02:07:56 +03:00
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
gem " rails "
G
2020-06-03 21:45:36 +03:00
bundle " binstubs rack " , :path = > " exec "
bundle :install
2018-11-03 02:07:56 +03:00
expect ( bundled_app ( " exec/rails " ) ) . to exist
end
end
context " with --standalone option " do
before do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
2023-01-27 04:39:27 +03:00
gem " rails "
2018-11-03 02:07:56 +03:00
G
end
it " generates a standalone binstub " do
2020-06-03 21:45:36 +03:00
bundle " binstubs rack --standalone "
2018-11-03 02:07:56 +03:00
expect ( bundled_app ( " bin/rackup " ) ) . to exist
end
it " generates a binstub that does not depend on rubygems or bundler " do
2020-06-03 21:45:36 +03:00
bundle " binstubs rack --standalone "
2018-11-03 02:07:56 +03:00
expect ( File . read ( bundled_app ( " bin/rackup " ) ) ) . to_not include ( " Gem.bin_path " )
end
context " when specified --path option " do
it " generates a standalone binstub at the given path " do
2020-06-03 21:45:36 +03:00
bundle " binstubs rack --standalone --path foo "
2018-11-03 02:07:56 +03:00
expect ( bundled_app ( " foo/rackup " ) ) . to exist
end
end
2020-12-08 10:36:29 +03:00
context " when specified --all-platforms option " do
it " generates standalone binstubs for all platforms " do
bundle " binstubs rack --standalone --all-platforms "
expect ( bundled_app ( " bin/rackup " ) ) . to exist
expect ( bundled_app ( " bin/rackup.cmd " ) ) . to exist
end
end
2023-01-27 04:39:27 +03:00
context " when the gem is bundler " do
it " warns without generating a standalone binstub " do
bundle " binstubs bundler --standalone "
expect ( bundled_app ( " bin/bundle " ) ) . not_to exist
expect ( bundled_app ( " bin/bundler " ) ) . not_to exist
expect ( err ) . to include ( " Sorry, Bundler can only be run via RubyGems. " )
end
end
context " when specified --all option " do
it " generates standalone binstubs for all gems except bundler " do
bundle " binstubs --standalone --all "
expect ( bundled_app ( " bin/rackup " ) ) . to exist
expect ( bundled_app ( " bin/rails " ) ) . to exist
expect ( bundled_app ( " bin/bundle " ) ) . not_to exist
expect ( bundled_app ( " bin/bundler " ) ) . not_to exist
expect ( err ) . not_to include ( " Sorry, Bundler can only be run via RubyGems. " )
end
end
2018-11-03 02:07:56 +03:00
end
context " when the bin already exists " do
it " doesn't overwrite and warns " do
FileUtils . mkdir_p ( bundled_app ( " bin " ) )
File . open ( bundled_app ( " bin/rackup " ) , " wb " ) do | file |
file . print " OMG "
end
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
bundle " binstubs rack "
expect ( bundled_app ( " bin/rackup " ) ) . to exist
expect ( File . read ( bundled_app ( " bin/rackup " ) ) ) . to eq ( " OMG " )
2019-04-14 09:01:35 +03:00
expect ( err ) . to include ( " Skipped rackup " )
expect ( err ) . to include ( " overwrite skipped stubs, use --force " )
2018-11-03 02:07:56 +03:00
end
context " when using --force " do
it " overwrites the binstub " do
FileUtils . mkdir_p ( bundled_app ( " bin " ) )
File . open ( bundled_app ( " bin/rackup " ) , " wb " ) do | file |
file . print " OMG "
end
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
bundle " binstubs rack --force "
expect ( bundled_app ( " bin/rackup " ) ) . to exist
expect ( File . read ( bundled_app ( " bin/rackup " ) ) ) . not_to eq ( " OMG " )
end
end
end
context " when the gem has no bins " do
it " suggests child gems if they have bins " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack-obama "
G
bundle " binstubs rack-obama "
2019-04-14 09:01:35 +03:00
expect ( err ) . to include ( " rack-obama has no executables " )
expect ( err ) . to include ( " rack has: rackup " )
2018-11-03 02:07:56 +03:00
end
it " works if child gems don't have bins " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " actionpack "
G
bundle " binstubs actionpack "
2019-04-14 09:01:35 +03:00
expect ( err ) . to include ( " no executables for the gem actionpack " )
2018-11-03 02:07:56 +03:00
end
it " works if the gem has development dependencies " do
2020-12-08 10:36:29 +03:00
build_repo2 do
build_gem " with_development_dependency " do | s |
s . add_development_dependency " activesupport " , " = 2.3.5 "
end
end
2018-11-03 02:07:56 +03:00
install_gemfile <<-G
2020-12-08 10:36:29 +03:00
source " #{ file_uri_for ( gem_repo2 ) } "
2018-11-03 02:07:56 +03:00
gem " with_development_dependency "
G
bundle " binstubs with_development_dependency "
2019-04-14 09:01:35 +03:00
expect ( err ) . to include ( " no executables for the gem with_development_dependency " )
2018-11-03 02:07:56 +03:00
end
end
context " when BUNDLE_INSTALL is specified " do
it " performs an automatic bundle install " do
gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
2019-04-14 09:01:35 +03:00
bundle " config set auto_install 1 "
2018-11-03 02:07:56 +03:00
bundle " binstubs rack "
expect ( out ) . to include ( " Installing rack 1.0.0 " )
expect ( the_bundle ) . to include_gems " rack 1.0.0 "
end
it " does nothing when already up to date " do
install_gemfile <<-G
2019-05-06 19:06:21 +03:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-03 02:07:56 +03:00
gem " rack "
G
2019-04-14 09:01:35 +03:00
bundle " config set auto_install 1 "
2019-12-14 13:49:16 +03:00
bundle " binstubs rack " , :env = > { " BUNDLE_INSTALL " = > " 1 " }
2018-11-03 02:07:56 +03:00
expect ( out ) . not_to include ( " Installing rack 1.0.0 " )
end
end
end