diff options
author | Andre Arko <andre@arko.net> | 2015-12-12 14:43:50 +0800 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-12-12 14:43:50 +0800 |
commit | 3f7f1200d711de0bf99dc041c376b5766f5080c3 (patch) | |
tree | 9c59969d1fb747d63309bd4fe55278d02e49faa5 /spec/commands | |
parent | 4592851188b0bcec3dac9b002fca4e80ec3018cf (diff) | |
parent | 44cedcca2314a6ab19005f1bd87a9efc0f486c47 (diff) | |
download | bundler-3f7f1200d711de0bf99dc041c376b5766f5080c3.tar.gz |
Merge pull request #4064 from pivotal-cf-experimental/master
Diffstat (limited to 'spec/commands')
-rw-r--r-- | spec/commands/install_spec.rb | 66 | ||||
-rw-r--r-- | spec/commands/update_spec.rb | 119 |
2 files changed, 185 insertions, 0 deletions
diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb index 5132e4cffb..7ca40092f1 100644 --- a/spec/commands/install_spec.rb +++ b/spec/commands/install_spec.rb @@ -340,6 +340,72 @@ describe "bundle install with gem sources" do end end + describe "Ruby version in Gemfile.lock" do + include Bundler::GemHelpers + + context "and using an unsupported Ruby version" do + it "prints an error" do + install_gemfile <<-G + ::RUBY_VERSION = '1.8.7' + ruby '~> 2.1' + G + expect(out).to include("Your Ruby version is 1.8.7, but your Gemfile specified ~> 2.1") + end + end + + context "and using a supported Ruby version" do + before do + install_gemfile <<-G + ::RUBY_VERSION = '2.1.3' + ::RUBY_PATCHLEVEL = 100 + ruby '~> 2.1.0' + G + end + + it "writes current Ruby version to Gemfile.lock" do + lockfile_should_be <<-L + GEM + specs: + + PLATFORMS + ruby + + DEPENDENCIES + + RUBY VERSION + ruby 2.1.3p100 + + BUNDLED WITH + #{Bundler::VERSION} + L + end + + it "does not update Gemfile.lock with updated ruby versions" do + install_gemfile <<-G + ::RUBY_VERSION = '2.2.3' + ::RUBY_PATCHLEVEL = 100 + ruby '~> 2.2.0' + G + + lockfile_should_be <<-L + GEM + specs: + + PLATFORMS + ruby + + DEPENDENCIES + + RUBY VERSION + ruby 2.1.3p100 + + BUNDLED WITH + #{Bundler::VERSION} + L + end + end + end + describe "when Bundler root contains regex chars" do before do root_dir = tmp("foo[]bar") diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index 0ea721d738..6bdca75ffe 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -319,3 +319,122 @@ describe "bundle update" do expect(exitstatus).to eq(22) if exitstatus end end + +describe "bundle update --ruby" do + context "when the Gemfile removes the ruby" do + it "removes the Ruby from the Gemfile.lock" do + install_gemfile <<-G + ::RUBY_VERSION = '2.1.3' + ::RUBY_PATCHLEVEL = 100 + ruby '~> 2.1.0' + G + + install_gemfile <<-G + ::RUBY_VERSION = '2.1.4' + ::RUBY_PATCHLEVEL = 222 + G + + bundle "update --ruby" + + lockfile_should_be <<-L + GEM + specs: + + PLATFORMS + ruby + + DEPENDENCIES + + BUNDLED WITH + #{Bundler::VERSION} + L + end + end + + context "when the Gemfile specified an updated Ruby verison" do + it "updates the Gemfile.lock with the latest version" do + install_gemfile <<-G + ::RUBY_VERSION = '2.1.3' + ::RUBY_PATCHLEVEL = 100 + ruby '~> 2.1.0' + G + + install_gemfile <<-G + ::RUBY_VERSION = '2.1.4' + ::RUBY_PATCHLEVEL = 222 + ruby '~> 2.1.0' + G + + bundle "update --ruby" + + lockfile_should_be <<-L + GEM + specs: + + PLATFORMS + ruby + + DEPENDENCIES + + RUBY VERSION + ruby 2.1.4p222 + + BUNDLED WITH + #{Bundler::VERSION} + L + end + end + + context "when a different Ruby is being used than has been versioned" do + it "shows a helpful error message" do + install_gemfile <<-G + ::RUBY_VERSION = '2.1.3' + ::RUBY_PATCHLEVEL = 100 + ruby '~> 2.1.0' + G + + install_gemfile <<-G + ::RUBY_VERSION = '2.2.2' + ::RUBY_PATCHLEVEL = 505 + ruby '~> 2.1.0' + G + + bundle "update --ruby" + expect(out).to include("Your Ruby version is 2.2.2, but your Gemfile specified ~> 2.1.0") + end + end + + context "when updating Ruby version and Gemfile `ruby`" do + it "updates the Gemfile.lock with the latest version" do + install_gemfile <<-G + ::RUBY_VERSION = '2.1.3' + ::RUBY_PATCHLEVEL = 100 + ruby '~> 2.1.0' + G + + install_gemfile <<-G + ::RUBY_VERSION = '1.8.3' + ::RUBY_PATCHLEVEL = 55 + ruby '~> 1.8.0' + G + + bundle "update --ruby" + + lockfile_should_be <<-L + GEM + specs: + + PLATFORMS + ruby + + DEPENDENCIES + + RUBY VERSION + ruby 1.8.3p55 + + BUNDLED WITH + #{Bundler::VERSION} + L + end + end +end |