summaryrefslogtreecommitdiff
path: root/spec/install/gems/resolving_spec.rb
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2016-06-06 23:02:31 -0700
committerSamuel Giddins <segiddins@segiddins.me>2016-07-10 12:07:57 -0300
commit7b4277831e73b49e9b6c3262e73ff8f0a1f8fb9d (patch)
tree8b8948abd2763578a5fd15a04fe0787058a0581c /spec/install/gems/resolving_spec.rb
parenta4169b08b22af64cccb84fb0f6f96c13b8a69c6c (diff)
downloadbundler-7b4277831e73b49e9b6c3262e73ff8f0a1f8fb9d.tar.gz
respect required_ruby_versions when present
Not only does this test mean that we’re sure the method works, I like how the method is structured now a lot better too :grin:
Diffstat (limited to 'spec/install/gems/resolving_spec.rb')
-rw-r--r--spec/install/gems/resolving_spec.rb45
1 files changed, 33 insertions, 12 deletions
diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb
index 74acf9a918..87e747d9e2 100644
--- a/spec/install/gems/resolving_spec.rb
+++ b/spec/install/gems/resolving_spec.rb
@@ -103,25 +103,46 @@ describe "bundle install with gem sources" do
end
end
- describe "when some gems require a different version of ruby" do
- it "does not try to install those gems" do
- update_repo gem_repo1 do
- build_gem "require_ruby" do |s|
- s.required_ruby_version = "> 9000"
+ describe "when a required ruby version" do
+ context "allows only an older version" do
+ it "installs the older version" do
+ update_repo gem_repo1 do
+ build_gem "rack", "9001.0.0" do |s|
+ s.required_ruby_version = "> 9000"
+ end
end
+
+ install_gemfile <<-G, :artifice => "compact_index"
+ ruby "#{RUBY_VERSION}"
+ source "file://#{gem_repo1}"
+ gem 'rack'
+ G
+
+ expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000")
+ should_be_installed("rack 1.0")
end
+ end
- install_gemfile <<-G, :artifice => "compact_index"
- source "file://#{gem_repo1}"
- gem 'require_ruby'
- G
+ context "allows no gems" do
+ it "does not try to install those gems" do
+ update_repo gem_repo1 do
+ build_gem "require_ruby" do |s|
+ s.required_ruby_version = "> 9000"
+ end
+ end
- expect(out).to_not include("Gem::InstallError: require_ruby requires Ruby version > 9000")
- expect(out).to include("require_ruby-1.0 requires ruby version > 9000, which is incompatible with the current version, #{Bundler::RubyVersion.system}")
+ install_gemfile <<-G, :artifice => "compact_index"
+ source "file://#{gem_repo1}"
+ gem 'require_ruby'
+ G
+
+ expect(out).to_not include("Gem::InstallError: require_ruby requires Ruby version > 9000")
+ expect(out).to include("require_ruby-1.0 requires ruby version > 9000, which is incompatible with the current version, #{Bundler::RubyVersion.system}")
+ end
end
end
- describe "when some gems require a different version of rubygems" do
+ describe "when a required rubygems version disallows a gem" do
it "does not try to install those gems" do
update_repo gem_repo1 do
build_gem "require_rubygems" do |s|