diff options
author | Terence Lee <hone02@gmail.com> | 2013-08-19 19:36:09 -0700 |
---|---|---|
committer | Terence Lee <hone02@gmail.com> | 2013-08-24 15:15:28 -0700 |
commit | e1ff1b281e4fe9932e6ff127f756f5acb03968ec (patch) | |
tree | b2fd581e221c015521d3794ee622d693d00211fd /spec/other/bundle_ruby_spec.rb | |
parent | 47964a138d964af49e0834806a9ef7930f322d0c (diff) | |
download | bundler-e1ff1b281e4fe9932e6ff127f756f5acb03968ec.tar.gz |
patchlevel support for ruby DSL
Diffstat (limited to 'spec/other/bundle_ruby_spec.rb')
-rw-r--r-- | spec/other/bundle_ruby_spec.rb | 180 |
1 files changed, 105 insertions, 75 deletions
diff --git a/spec/other/bundle_ruby_spec.rb b/spec/other/bundle_ruby_spec.rb index 5bb563a7..7d41a00d 100644 --- a/spec/other/bundle_ruby_spec.rb +++ b/spec/other/bundle_ruby_spec.rb @@ -1,112 +1,142 @@ require "spec_helper" describe "bundle_ruby" do - it "returns the ruby version" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.9.3", :engine => 'ruby', :engine_version => '1.9.3' + context "without patchlevel" do + it "returns the ruby version" 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_ruby + bundle_ruby - expect(out).to eq("ruby 1.9.3") - end + expect(out).to eq("ruby 1.9.3") + end - it "engine defaults to MRI" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.9.3" + it "engine defaults to MRI" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.9.3" - gem "foo" - G + gem "foo" + G - bundle_ruby + bundle_ruby - expect(out).to eq("ruby 1.9.3") - end + expect(out).to 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 "handles jruby" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.8.7", :engine => 'jruby', :engine_version => '1.6.5' - gem "foo" - G + gem "foo" + G - bundle_ruby + bundle_ruby - expect(out).to eq("ruby 1.8.7 (jruby 1.6.5)") - end + expect(out).to eq("ruby 1.8.7 (jruby 1.6.5)") + end - it "handles rbx" do - gemfile <<-G - source "file://#{gem_repo1}" - ruby "1.8.7", :engine => 'rbx', :engine_version => '1.2.4' + it "handles rbx" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.8.7", :engine => 'rbx', :engine_version => '1.2.4' - gem "foo" - G + gem "foo" + G - bundle_ruby + bundle_ruby - expect(out).to eq("ruby 1.8.7 (rbx 1.2.4)") - end + expect(out).to 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' + 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 + gem "foo" + G - bundle_ruby :exitstatus => true - expect(exitstatus).not_to eq(0) + bundle_ruby :exitstatus => true + expect(exitstatus).not_to eq(0) - bundle_ruby - expect(out).to eq("Please define :engine_version") - end + bundle_ruby + expect(out).to eq("Please define :engine_version") + 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' + 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 + gem "foo" + G - bundle_ruby :exitstatus => true - expect(exitstatus).not_to eq(0) + bundle_ruby :exitstatus => true + expect(exitstatus).not_to eq(0) - bundle_ruby - expect(out).to eq("Please define :engine") - end + bundle_ruby + expect(out).to eq("Please define :engine") + 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' - 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 - gem "foo" - G + bundle_ruby :exitstatus => true + expect(exitstatus).not_to eq(0) - bundle_ruby :exitstatus => true - expect(exitstatus).not_to eq(0) + bundle_ruby + expect(out).to eq("ruby_version must match the :engine_version for MRI") + end - bundle_ruby - expect(out).to eq("ruby_version must match the :engine_version for MRI") + it "should print if no ruby version is specified" do + gemfile <<-G + source "file://#{gem_repo1}" + + gem "foo" + G + + bundle_ruby + + expect(out).to eq("No ruby version specified") + end end - it "should print if no ruby version is specified" do - gemfile <<-G - source "file://#{gem_repo1}" + context "when using patchlevel" do + it "returns the ruby version" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.9.3", :patchlevel => 429, :engine => 'ruby', :engine_version => '1.9.3' + + gem "foo" + G + + bundle_ruby + + expect(out).to eq("ruby 1.9.3p429") + end + + it "handles an engine" do + gemfile <<-G + source "file://#{gem_repo1}" + ruby "1.9.3", :patchlevel => 392, :engine => 'jruby', :engine_version => '1.7.4' - gem "foo" - G + gem "foo" + G - bundle_ruby + bundle_ruby - expect(out).to eq("No ruby version specified") + expect(out).to eq("ruby 1.9.3p392 (jruby 1.7.4)") + end end end |