Accept operator in 'ruby' line at Gemfile #2228

Closed
wants to merge 3 commits into
from
@@ -44,9 +44,9 @@ def ==(other)
def diff(other)
if engine != other.engine && @input_engine
[ :engine, engine, other.engine ]
- elsif version != other.version
+ elsif !Gem::Requirement.create(version).satisfied_by?(Gem::Version.create(other.version))
[ :version, version, other.version ]
- elsif engine_version != other.engine_version && @input_engine
+ elsif !Gem::Requirement.create(engine_version).satisfied_by?(Gem::Version.create(other.engine_version)) && @input_engine
[ :engine_version, engine_version, other.engine_version ]
else
nil
@@ -109,4 +109,17 @@
expect(out).to eq("No ruby version specified")
end
+
+ it "should return required version" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ ruby ">= 1.9.3"
+
+ gem "foo"
+ G
+
+ bundle_ruby
+
+ expect(out).to eq("ruby >= 1.9.3")
+ end
end
@@ -43,6 +43,29 @@
G
end
+ it "is within limit range" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ #{ruby_version_upper_limit}
+
+ gem "foo"
+ G
+
+ bundle "platform"
+ expect(out).to eq(<<-G.chomp)
+Your platform is: #{RUBY_PLATFORM}
+
+Your app has gems that work on these platforms:
+* ruby
+
+Your Gemfile specifies a Ruby version requirement:
+* ruby <= #{local_ruby_version_bumped}
+
+Your current platform satisfies the Ruby version requirement.
+G
+ end
+
it "doesn't match the ruby version requirement" do
gemfile <<-G
source "file://#{gem_repo1}"
@@ -174,6 +197,7 @@
end
let(:ruby_version_correct) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{local_engine_version}\"" }
+ let(:ruby_version_upper_limit) { "ruby \"<= #{local_ruby_version_bumped}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"<= #{local_engine_version_bumped}\"" }
let(:ruby_version_correct_engineless) { "ruby \"#{RUBY_VERSION}\"" }
let(:ruby_version_incorrect) { "ruby \"#{not_local_ruby_version}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_ruby_version}\"" }
let(:engine_incorrect) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{not_local_tag}\", :engine_version => \"#{RUBY_VERSION}\"" }
@@ -82,5 +82,13 @@ def not_local_engine_version
def not_local_ruby_version
"1.12"
end
+
+ def local_ruby_version_bumped
+ Gem::Version.create(RUBY_VERSION).bump.version
+ end
+
+ def local_engine_version_bumped
+ Gem::Version.create(local_engine_version).bump.version
+ end
end
end