Skip to content

Instantly share code, notes, and snippets.

@hone
Created March 7, 2012 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hone/1990080 to your computer and use it in GitHub Desktop.
Save hone/1990080 to your computer and use it in GitHub Desktop.
require "spec_helper"
describe "bundle ruby" 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'
gem "foo"
G
bundle "ruby"
out.should eq("ruby 1.9.3 (ruby 1.9.3)")
end
it "engine defaults to MRI" do
gemfile <<-G
source "file://#{gem_repo1}"
ruby_version "1.9.3"
gem "foo"
G
bundle "ruby"
out.should eq("ruby 1.9.3 (ruby 1.9.3)")
end
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
bundle "ruby"
out.should eq("ruby 1.8.7 (jruby 1.6.5)")
end
it "handles rbx" do
gemfile <<-G
source "file://#{gem_repo1}"
ruby_version "1.8.7", :engine => 'rbx', :engine_version => '1.2.4'
gem "foo"
G
bundle "ruby"
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_version "1.8.7", :engine => 'rbx'
gem "foo"
G
bundle "ruby", :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_version "1.8.7", :engine_version => '1.2.4'
gem "foo"
G
bundle "ruby", :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_version "1.8.7", :engine => 'rbx', :engine_version => '1.2.4'
gem "foo"
G
bundle "ruby", :exitstatus => true
exitstatus.should_not == 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment