diff options
author | Terence Lee <hone02@gmail.com> | 2012-04-28 15:03:05 -0500 |
---|---|---|
committer | Terence Lee <hone02@gmail.com> | 2012-05-03 16:26:05 -0700 |
commit | b484ed15e0955c0d0145775d63a4871d35060734 (patch) | |
tree | 7da1acdfc7c0596eadb98be9ad1a55dc0738149f /spec | |
parent | 4ef6cc26d6840c845739b2d7f2a86eafc347197c (diff) | |
download | bundler-b484ed15e0955c0d0145775d63a4871d35060734.tar.gz |
change dsl for ruby_version to ruby
Diffstat (limited to 'spec')
-rw-r--r-- | spec/other/ruby_spec.rb | 198 |
1 files changed, 133 insertions, 65 deletions
diff --git a/spec/other/ruby_spec.rb b/spec/other/ruby_spec.rb index bb80024335..e39cea350c 100644 --- a/spec/other/ruby_spec.rb +++ b/spec/other/ruby_spec.rb @@ -1,101 +1,169 @@ require "spec_helper" describe "bundle platform" do - it "returns ruby version when explicit" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby_version "1.9.3", :engine => 'ruby', :engine_version => '1.9.3' + context "without flags" do + it "returns all the output" do + gemfile <<-G + source "file://#{gem_repo1}" - gem "foo" - G + #{ruby_version_correct} - bundle "platform" + gem "foo" + G - out.should eq("ruby 1.9.3") - end + bundle "platform" + out.should == <<-G.chomp +Your platform is: #{RUBY_PLATFORM} - it "engine defaults to MRI" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby_version "1.9.3" +Your app has gems that work on these platforms: +ruby - gem "foo" - G +Your Gemfile specifies a Ruby version requirement: +* ruby #{RUBY_VERSION} - bundle "platform" +Your current platform satisfies the Ruby version requirement. +G + end - out.should eq("ruby 1.9.3") - end + it "doesn't print ruby version requirement if it isn't specified" do + gemfile <<-G + source "file://#{gem_repo1}" - it "handles jruby" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby_version "1.8.7", :engine => 'jruby', :engine_version => '1.6.5' + gem "foo" + G - gem "foo" - G + bundle "platform" + out.should == <<-G.chomp +Your platform is: #{RUBY_PLATFORM} - bundle "platform" +Your app has gems that work on these platforms: +ruby - out.should eq("ruby 1.8.7 (jruby 1.6.5)") - end +Your Gemfile does not specify a Ruby version requirement. +G + end + + it "doesn't match the ruby version requirement" do + gemfile <<-G + source "file://#{gem_repo1}" - it "handles rbx" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby_version "1.8.7", :engine => 'rbx', :engine_version => '1.2.4' + #{ruby_version_incorrect} - gem "foo" - G + gem "foo" + G - bundle "platform" + bundle "platform" + out.should == <<-G.chomp +Your platform is: #{RUBY_PLATFORM} - out.should eq("ruby 1.8.7 (rbx 1.2.4)") +Your app has gems that work on these platforms: +ruby + +Your Gemfile specifies a Ruby version requirement: +* ruby #{not_local_ruby_version} + +Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version} +G + end end - it "raises an error if engine is used but engine version is not" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby_version "1.8.7", :engine => 'rbx' + context "--ruby" do + it "returns ruby version when explicit" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.9.3", :engine => 'ruby', :engine_version => '1.9.3' - gem "foo" - G + gem "foo" + G - bundle "platform", :exitstatus => true + bundle "platform" - exitstatus.should_not == 0 - end + out.should eq("ruby 1.9.3") + end - it "raises an error if engine_version is used but engine is not" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby_version "1.8.7", :engine_version => '1.2.4' + it "engine defaults to MRI" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.9.3" - gem "foo" - G + gem "foo" + G - bundle "platform", :exitstatus => true + bundle "platform" - exitstatus.should_not == 0 - end + out.should eq("ruby 1.9.3") + end + + it "handles jruby" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.8.7", :engine => 'jruby', :engine_version => '1.6.5' - it "raises an error if engine version doesn't match ruby version for mri" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby_version "1.8.7", :engine => 'ruby', :engine_version => '1.2.4' + gem "foo" + G + + bundle "platform" - gem "foo" - G + out.should eq("ruby 1.8.7 (jruby 1.6.5)") + end - bundle "platform", :exitstatus => true + it "handles rbx" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.8.7", :engine => 'rbx', :engine_version => '1.2.4' - exitstatus.should_not == 0 + gem "foo" + G + + bundle "platform" + + out.should eq("ruby 1.8.7 (rbx 1.2.4)") + end + + it "raises an error if engine is used but engine version is not" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.8.7", :engine => 'rbx' + + gem "foo" + G + + bundle "platform", :exitstatus => true + + exitstatus.should_not == 0 + end + + it "raises an error if engine_version is used but engine is not" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.8.7", :engine_version => '1.2.4' + + gem "foo" + G + + bundle "platform", :exitstatus => true + + exitstatus.should_not == 0 + end + + it "raises an error if engine version doesn't match ruby version for mri" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.8.7", :engine => 'ruby', :engine_version => '1.2.4' + + gem "foo" + G + + bundle "platform", :exitstatus => true + + exitstatus.should_not == 0 + end end - let(:ruby_version_correct) { "ruby_version \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{local_engine_version}\"" } - let(:ruby_version_incorrect) { "ruby_version \"#{not_local_ruby_version}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_ruby_version}\"" } - let(:engine_incorrect) { "ruby_version \"#{RUBY_VERSION}\", :engine => \"#{not_local_tag}\", :engine_version => \"#{RUBY_VERSION}\"" } - let(:engine_version_incorrect) { "ruby_version \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_engine_version}\"" } + let(:ruby_version_correct) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{local_engine_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}\"" } + let(:engine_version_incorrect) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_engine_version}\"" } def should_be_ruby_version_incorrect(opts = {:exitstatus => true}) exitstatus.should eq(18) if opts[:exitstatus] |