diff options
author | Joel Van Horn <joel@joelvanhorn.com> | 2018-01-24 12:39:55 -0500 |
---|---|---|
committer | Joel Van Horn <joel@joelvanhorn.com> | 2018-01-24 12:39:55 -0500 |
commit | 8a013be9e9660af6f872dfbf5d067b95d0c943c2 (patch) | |
tree | e9f6e4ad6c6fa221953c9b9ee3273ce8b0b27df3 /spec/update | |
parent | 0034ef3416ca94d00839361dbeb0485b10a09c51 (diff) | |
download | bundler-8a013be9e9660af6f872dfbf5d067b95d0c943c2.tar.gz |
Added `--gemfile` option to `bundle update`
Diffstat (limited to 'spec/update')
-rw-r--r-- | spec/update/gemfile_spec.rb | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/spec/update/gemfile_spec.rb b/spec/update/gemfile_spec.rb new file mode 100644 index 0000000000..71084270cb --- /dev/null +++ b/spec/update/gemfile_spec.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +RSpec.describe "bundle update" do + context "with --gemfile" do + it "finds the gemfile" do + gemfile bundled_app("NotGemfile"), <<-G + source "file://#{gem_repo1}" + gem 'rack' + G + + bundle! :install, :gemfile => bundled_app("NotGemfile") + bundle! :update, :all => bundle_update_requires_all?, :gemfile => bundled_app("NotGemfile") + + ENV["BUNDLE_GEMFILE"] = "NotGemfile" + expect(the_bundle).to include_gems "rack 1.0.0" + end + end + + context "with gemfile set via config" do + before do + gemfile bundled_app("NotGemfile"), <<-G + source "file://#{gem_repo1}" + gem 'rack' + G + + bundle "config --local gemfile #{bundled_app("NotGemfile")}" + bundle! :install + end + it "uses the gemfile to update" do + bundle! "update", :all => bundle_update_requires_all? + bundle "list" + + expect(out).to include("rack (1.0.0)") + end + it "uses the gemfile while in a subdirectory" do + bundled_app("subdir").mkpath + Dir.chdir(bundled_app("subdir")) do + bundle! "update", :all => bundle_update_requires_all? + bundle "list" + + expect(out).to include("rack (1.0.0)") + end + end + end + + context "with prefer_gems_rb set" do + it "prefers gems.rb to Gemfile" do + create_file("gems.rb", "gem 'bundler'") + create_file("Gemfile", "raise 'wrong Gemfile!'") + + bundle! "config prefer_gems_rb true" + bundle! :install + bundle! :update, :all => bundle_update_requires_all? + + expect(bundled_app("gems.rb")).to be_file + expect(bundled_app("Gemfile.lock")).not_to be_file + + expect(the_bundle).to include_gem "bundler #{Bundler::VERSION}" + end + end +end |