summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-11-10 19:16:54 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-11-10 19:16:54 +0100
commit2953979277ea07ac0a55bc7e661a97707e502489 (patch)
tree7f2f65e966a2915b5aaa094a8d2233a47e211977
parent623a2e4b8624949c9419a73e66a315a014970561 (diff)
downloadbundler-2_1_0_pre_3_with_lazy_readline.tar.gz
Improve binstub specs2_1_0_pre_3_with_lazy_readline
-rw-r--r--spec/commands/binstubs_spec.rb75
1 files changed, 49 insertions, 26 deletions
diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb
index 81b4d99064..df10bd3498 100644
--- a/spec/commands/binstubs_spec.rb
+++ b/spec/commands/binstubs_spec.rb
@@ -141,38 +141,61 @@ RSpec.describe "bundle binstubs <gem>" do
end
context "when a lockfile exists with a locked bundler version" do
- it "runs the correct version of bundler when the version is newer" do
- lockfile lockfile.gsub(system_bundler_version, "999.999.999")
- sys_exec "#{bundled_app("bin/bundle")} install"
- expect(exitstatus).to eq(42) if exitstatus
- 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'`")
+ 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
+ sys_exec "#{bundled_app("bin/bundle")} install"
+ expect(exitstatus).to eq(42) if exitstatus
+ 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
- it "runs the correct version of bundler when the version is older and a different major" do
- simulate_bundler_version "55"
- lockfile lockfile.gsub(system_bundler_version, "44.0")
- sys_exec "#{bundled_app("bin/bundle")} install"
- expect(exitstatus).to eq(42) if exitstatus
- 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'`")
+ 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
+ sys_exec "#{bundled_app("bin/bundle")} install"
+ expect(exitstatus).to eq(42) if exitstatus
+ 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
- it "runs the available version of bundler when the version is older and the same major" do
- simulate_bundler_version "55.1"
- lockfile lockfile.gsub(system_bundler_version, "55.0")
- sys_exec "#{bundled_app("bin/bundle")} install"
- expect(exitstatus).not_to eq(42) if exitstatus
- expect(err).not_to include("Activating bundler (~> 55.0) failed:")
+ context "and the version is older and the same major" do
+ let(:system_bundler_version) { "55.1" }
+
+ before do
+ lockfile lockfile.gsub(/BUNDLED WITH\n .*$/m, "BUNDLED WITH\n 55.0")
+ end
+
+ it "runs the available version of bundler when the version is older and the same major" do
+ sys_exec "#{bundled_app("bin/bundle")} install"
+ expect(exitstatus).not_to eq(42) if exitstatus
+ expect(err).not_to include("Activating bundler (~> 55.0) failed:")
+ end
end
- it "runs the correct version of bundler when the version is a pre-release" do
- simulate_bundler_version "55"
- lockfile lockfile.gsub(system_bundler_version, "2.12.0.a")
- sys_exec "#{bundled_app("bin/bundle")} install"
- expect(exitstatus).to eq(42) if exitstatus
- 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'`")
+ 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
+ sys_exec "#{bundled_app("bin/bundle")} install"
+ expect(exitstatus).to eq(42) if exitstatus
+ 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
end
end