diff options
author | Agrim Mittal <agrimmittal97@gmail.com> | 2018-02-26 04:28:18 +0530 |
---|---|---|
committer | Agrim Mittal <agrimmittal97@gmail.com> | 2018-02-26 04:52:02 +0530 |
commit | 94d399d6894c0ca312386520388e48971dd286ed (patch) | |
tree | e677f9bbd973ad56513a9deaf45187f3f21c4d9b /spec/install/gemfile | |
parent | 6d563b03f6ec105b54ebae6bc7fab2eee35e6eec (diff) | |
download | bundler-94d399d6894c0ca312386520388e48971dd286ed.tar.gz |
Add documentation and tests for disable_platform_warnings
Diffstat (limited to 'spec/install/gemfile')
-rw-r--r-- | spec/install/gemfile/platform_spec.rb | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/spec/install/gemfile/platform_spec.rb b/spec/install/gemfile/platform_spec.rb index d7d4e0a53c..ec19005ef4 100644 --- a/spec/install/gemfile/platform_spec.rb +++ b/spec/install/gemfile/platform_spec.rb @@ -230,21 +230,46 @@ RSpec.describe "bundle install with platform conditionals" do expect(out).not_to match(/Could not find gem 'some_gem/) end - it "prints a helpful warning when a dependency is unused on any platform" do - simulate_platform "ruby" - simulate_ruby_engine "ruby" + context "when disable_platform_warnings is false (by default)" do + before { bundle! "config disable_platform_warnings false" } - gemfile <<-G - source "file://#{gem_repo1}" + it "prints a helpful warning when a dependency is unused on any platform" do + simulate_platform "ruby" + simulate_ruby_engine "ruby" - gem "rack", :platform => [:mingw, :mswin, :x64_mingw, :jruby] - G + gemfile <<-G + source "file://#{gem_repo1}" + + gem "rack", :platform => [:mingw, :mswin, :x64_mingw, :jruby] + G - bundle! "install" + bundle! "install" - expect(out).to include <<-O.strip -The dependency #{Gem::Dependency.new("rack", ">= 0")} will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. - O + expect(out).to include <<-O.strip + The dependency #{Gem::Dependency.new("rack", ">= 0")} will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. + O + end + end + + context "when disable_platform_warnings is true" do + before { bundle! "config disable_platform_warnings true" } + + it "doesnot print the warning when a dependency is unused on any platform" do + simulate_platform "ruby" + simulate_ruby_engine "ruby" + + gemfile <<-G + source "file://#{gem_repo1}" + + gem "rack", :platform => [:mingw, :mswin, :x64_mingw, :jruby] + G + + bundle! "install" + + expect(out).not_to include <<-O.strip + The dependency #{Gem::Dependency.new("rack", ">= 0")} will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. + O + end end end |