Skip to content
Browse files

ruby version check for bundle#show

  • Loading branch information...
1 parent 86ca88d commit 07c3e4805eec7e8f3a7d7d9b1eadb608168b6d2a @hone hone committed Apr 22, 2012
Showing with 60 additions and 0 deletions.
  1. +1 −0 lib/bundler/cli.rb
  2. +59 −0 spec/other/ruby_spec.rb
View
1 lib/bundler/cli.rb
@@ -297,6 +297,7 @@ def update(*gems)
method_option "paths", :type => :boolean,
:banner => "List the paths of all gems that are required by your Gemfile."
def show(gem_name = nil)
+ Bundler.definition.validate_ruby!
Bundler.load.lock
if gem_name
View
59 spec/other/ruby_spec.rb
@@ -313,4 +313,63 @@ def should_be_engine_version_incorrect
end
end
end
+
+ context "bundle show" do
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rails"
+ G
+ end
+
+ it "prints path if ruby version is correct" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rails"
+
+ #{ruby_version_correct}
+ G
+
+ bundle "show rails"
+ out.should == default_bundle_path('gems', 'rails-2.3.2').to_s
+ end
+
+ it "fails if ruby version doesn't match" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rails"
+
+ #{ruby_version_incorrect}
+ G
+
+ bundle "show rails", :exitstatus => true
+ should_be_ruby_version_incorrect
+ end
+
+ it "fails if engine doesn't match" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rails"
+
+ #{engine_incorrect}
+ G
+
+ bundle "show rails", :exitstatus => true
+ should_be_engine_incorrect
+ end
+
+ it "fails if engine version doesn't match" do
+ simulate_ruby_engine "jruby" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rails"
+
+ #{engine_version_incorrect}
+ G
+
+ bundle "show rails", :exitstatus => true
+ should_be_engine_version_incorrect
+ end
+ end
+ end
end

0 comments on commit 07c3e48

Please sign in to comment.
Something went wrong with that request. Please try again.