diff options
author | Andre Arko <andre@arko.net> | 2010-04-19 18:40:10 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2010-04-23 10:01:12 -0700 |
commit | 33cd28bbc11f8ea38f1413823de4f18b84d9d775 (patch) | |
tree | 36c0114a8edd7f1b6b27664f63fe2099bb86d9ea | |
parent | 2c88f252df04db3f3c61fa3ab282b55a07b07126 (diff) | |
download | bundler-33cd28bbc11f8ea38f1413823de4f18b84d9d775.tar.gz |
Fix platform specs so they are actually _capable_ of failing
-rw-r--r-- | spec/install/gems/simple_case_spec.rb | 51 | ||||
-rw-r--r-- | spec/support/builders.rb | 5 | ||||
-rw-r--r-- | spec/support/platforms.rb | 10 |
3 files changed, 55 insertions, 11 deletions
diff --git a/spec/install/gems/simple_case_spec.rb b/spec/install/gems/simple_case_spec.rb index 4eb75b8e..70a148fd 100644 --- a/spec/install/gems/simple_case_spec.rb +++ b/spec/install/gems/simple_case_spec.rb @@ -115,15 +115,50 @@ describe "bundle install with gem sources" do should_be_installed "rack 1.0.0", "activesupport 2.3.5" end - it "installs gems for the correct platform" do - Gem.platforms = [rb] - install_gemfile <<-G - source "file://#{gem_repo1}" - gem "platform_specific" - G + describe "with a gem that installs multiple platforms" do + it "installs gems for the local platform as first choice" do + install_gemfile <<-G + Gem.platforms = [#{rb}, Gem::Platform.local] + source "file://#{gem_repo1}" + gem "platform_specific" + G + + run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" + out.should == "1.0.0 #{Gem::Platform.local}" + end + + it "falls back on plain ruby" do + install_gemfile <<-G + Gem.platforms = [#{rb}, #{linux}] + source "file://#{gem_repo1}" + gem "platform_specific" + G + + run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" + out.should == "1.0.0 RUBY" + end + + it "installs gems for java" do + install_gemfile <<-G + Gem.platforms = [#{java}] + source "file://#{gem_repo1}" + gem "platform_specific" + G + + run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" + out.should == "1.0.0 JAVA" + end + + it "installs gems for windows" do + install_gemfile <<-G + Gem.platforms = [#{mswin}] + source "file://#{gem_repo1}" + gem "platform_specific" + G - run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" - out.should == "1.0.0 #{Gem::Platform.local}" + run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" + out.should == "1.0.0 MSWIN" + end end it "ensures that gems are actually installed and not just cached" do diff --git a/spec/support/builders.rb b/spec/support/builders.rb index bb80c1d0..4ace2615 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -83,6 +83,11 @@ module Spec s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 RUBY'" end + build_gem "platform_specific" do |s| + s.platform = "x86-mswin32" + s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 MSWIN'" + end + build_gem "only_java" do |s| s.platform = "java" end diff --git a/spec/support/platforms.rb b/spec/support/platforms.rb index 2598488b..09f4dcda 100644 --- a/spec/support/platforms.rb +++ b/spec/support/platforms.rb @@ -1,15 +1,19 @@ module Spec module Platforms def rb - Gem::Platform::RUBY + %|Gem::Platform::RUBY| end def java - Gem::Platform.new [nil, "java", nil] + %|Gem::Platform.new([nil, "java", nil])| end def linux - Gem::Platform.new ['x86', 'linux', nil] + %|Gem::Platform.new(['x86', 'linux', nil])| + end + + def mswin + %|Gem::Platform.new(['x86', 'mswin32', nil])| end end end
\ No newline at end of file |