summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-03-09 15:02:21 -0800
committerCarlhuda <carlhuda@engineyard.com>2010-03-09 15:02:21 -0800
commitf278f83d1de4caa8b745e8189b26393e0a08e72f (patch)
tree486f7112d2a1f4422d6302822a79aee82d49f258
parent55a4c22ba909a99f5da7d92945090c162fe0f4ef (diff)
downloadbundler-f278f83d1de4caa8b745e8189b26393e0a08e72f.tar.gz
Reorganize the install specs
-rw-r--r--spec/install/gems_spec.rb369
1 files changed, 186 insertions, 183 deletions
diff --git a/spec/install/gems_spec.rb b/spec/install/gems_spec.rb
index 409ea341cb..5ce4704466 100644
--- a/spec/install/gems_spec.rb
+++ b/spec/install/gems_spec.rb
@@ -1,154 +1,156 @@
require File.expand_path('../../spec_helper', __FILE__)
describe "bundle install with gem sources" do
- it "prints output and returns if no dependencies are specified" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- G
+ describe "the happy path" do
+ it "prints output and returns if no dependencies are specified" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ G
- bundle :install
- out.should =~ /no dependencies/
- end
+ bundle :install
+ out.should =~ /no dependencies/
+ end
- it "fetches gems" do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem 'rack'
- G
+ it "fetches gems" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem 'rack'
+ G
- default_bundle_path("gems/rack-1.0.0").should exist
- should_be_installed("rack 1.0.0")
- end
+ default_bundle_path("gems/rack-1.0.0").should exist
+ should_be_installed("rack 1.0.0")
+ end
- it "pulls in dependencies" do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rails"
- G
+ it "pulls in dependencies" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rails"
+ G
- should_be_installed "actionpack 2.3.2", "rails 2.3.2"
- end
+ should_be_installed "actionpack 2.3.2", "rails 2.3.2"
+ end
- it "does the right version" do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack", "0.9.1"
- G
+ it "does the right version" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", "0.9.1"
+ G
- should_be_installed "rack 0.9.1"
- end
+ should_be_installed "rack 0.9.1"
+ end
- it "does not install the development dependency" do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "with_development_dependency"
- G
+ it "does not install the development dependency" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "with_development_dependency"
+ G
- should_be_installed "with_development_dependency 1.0.0"
- should_not_be_installed "activesupport 2.3.5"
- end
+ should_be_installed "with_development_dependency 1.0.0"
+ should_not_be_installed "activesupport 2.3.5"
+ end
- it "resolves correctly" do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "activemerchant"
- gem "rails"
- G
+ it "resolves correctly" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "activemerchant"
+ gem "rails"
+ G
- should_be_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2"
- end
+ should_be_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2"
+ end
- it "activates gem correctly according to the resolved gems" do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "activesupport", "2.3.5"
- G
+ it "activates gem correctly according to the resolved gems" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "activesupport", "2.3.5"
+ G
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "activemerchant"
- gem "rails"
- G
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "activemerchant"
+ gem "rails"
+ G
- should_be_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2"
- end
+ should_be_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2"
+ end
- it "does not reinstall any gem that is already available locally" do
- system_gems "activesupport-2.3.2"
+ it "does not reinstall any gem that is already available locally" do
+ system_gems "activesupport-2.3.2"
- build_repo2 do
- build_gem "activesupport", "2.3.2" do |s|
- s.write "lib/activesupport.rb", "ACTIVESUPPORT = 'fail'"
+ build_repo2 do
+ build_gem "activesupport", "2.3.2" do |s|
+ s.write "lib/activesupport.rb", "ACTIVESUPPORT = 'fail'"
+ end
end
+
+ install_gemfile <<-G
+ source "file://#{gem_repo2}"
+ gem "activerecord", "2.3.2"
+ G
+
+ should_be_installed "activesupport 2.3.2"
end
- install_gemfile <<-G
- source "file://#{gem_repo2}"
- gem "activerecord", "2.3.2"
- G
+ it "works when the gemfile specifies gems that only exist in the system" do
+ build_gem "foo", :to_system => true
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ gem "foo"
+ G
- should_be_installed "activesupport 2.3.2"
- end
+ should_be_installed "rack 1.0.0", "foo 1.0.0"
+ end
- it "works when the gemfile specifies gems that only exist in the system" do
- build_gem "foo", :to_system => true
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- gem "foo"
- G
+ it "prioritizes local gems over remote gems" do
+ build_gem 'rack', '1.0.0', :to_system => true do |s|
+ s.add_dependency "activesupport", "2.3.5"
+ end
- should_be_installed "rack 1.0.0", "foo 1.0.0"
- end
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
- it "prioritizes local gems over remote gems" do
- build_gem 'rack', '1.0.0', :to_system => true do |s|
- s.add_dependency "activesupport", "2.3.5"
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
end
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- G
+ it "installs gems for the correct platform" do
+ Gem.platforms = [rb]
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "platform_specific"
+ G
- should_be_installed "rack 1.0.0", "activesupport 2.3.5"
- end
+ run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
+ out.should == "1.0.0 #{Gem::Platform.local}"
+ end
- it "installs gems for the correct platform" do
- Gem.platforms = [rb]
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "platform_specific"
- G
+ it "ensures that gems are actually installed and not just cached" do
+ build_repo2
+ gemfile <<-G
+ source "file://#{gem_repo2}"
+ group :foo do
+ gem "rack"
+ end
+ G
- run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
- out.should == "1.0.0 #{Gem::Platform.local}"
- end
+ bundle "install --without foo"
- it "ensures that gems are actually installed and not just cached" do
- build_repo2
- gemfile <<-G
- source "file://#{gem_repo2}"
- group :foo do
+ gemfile <<-G
+ source "file://#{gem_repo2}"
gem "rack"
- end
- G
-
- bundle "install --without foo"
-
- gemfile <<-G
- source "file://#{gem_repo2}"
- gem "rack"
- G
+ G
- update_repo gem_repo2 do
- build_gem "rack" do |s|
- s.write "lib/rack.rb", "raise 'omgomgomg'"
+ update_repo gem_repo2 do
+ build_gem "rack" do |s|
+ s.write "lib/rack.rb", "raise 'omgomgomg'"
+ end
end
- end
- bundle "install"
- should_be_installed "rack 1.0.0"
+ bundle "install"
+ should_be_installed "rack 1.0.0"
+ end
end
describe "with extra sources" do
@@ -309,7 +311,6 @@ describe "bundle install with gem sources" do
end
end
-
describe "when passing in a Gemfile via --gemfile" do
it "finds the gemfile" do
gemfile bundled_app("NotGemfile"), <<-G
@@ -412,88 +413,90 @@ describe "bundle install with gem sources" do
end
end
- describe "when specifying groups not excluded" do
- before :each do
- install_gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- group :emo do
- gem "activesupport", "2.3.5"
- end
- G
- end
+ describe "with groups" do
+ describe "installing with no options" do
+ before :each do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ group :emo do
+ gem "activesupport", "2.3.5"
+ end
+ G
+ end
- it "installs gems in the default group" do
- should_be_installed "rack 1.0.0"
- end
+ it "installs gems in the default group" do
+ should_be_installed "rack 1.0.0"
+ end
- it "installs gems in other groups" do
- should_be_installed "activesupport 2.3.5"
- end
+ it "installs gems in other groups" do
+ should_be_installed "activesupport 2.3.5"
+ end
- it "sets up everything if Bundler.setup is used with no groups" do
- out = run("require 'rack'; puts RACK")
- out.should == '1.0.0'
+ it "sets up everything if Bundler.setup is used with no groups" do
+ out = run("require 'rack'; puts RACK")
+ out.should == '1.0.0'
- out = run("require 'activesupport'; puts ACTIVESUPPORT")
- out.should == '2.3.5'
+ out = run("require 'activesupport'; puts ACTIVESUPPORT")
+ out.should == '2.3.5'
+ end
end
- end
- describe "when excluding groups" do
- before :each do
- gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- group :emo do
- gem "activesupport", "2.3.5"
- end
- G
- end
+ describe "installing --without" do
+ before :each do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ group :emo do
+ gem "activesupport", "2.3.5"
+ end
+ G
+ end
- it "installs gems in the default group" do
- bundle :install, :without => "emo"
- should_be_installed "rack 1.0.0", :groups => [:default]
- end
+ it "installs gems in the default group" do
+ bundle :install, :without => "emo"
+ should_be_installed "rack 1.0.0", :groups => [:default]
+ end
- it "does not install gems from the excluded group" do
- bundle :install, :without => "emo"
- should_not_be_installed "activesupport 2.3.5", :groups => [:default]
- end
+ it "does not install gems from the excluded group" do
+ bundle :install, :without => "emo"
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
+ end
- it "does not say it installed gems from the excluded group" do
- bundle :install, :without => "emo"
- out.should_not include("activesupport")
- end
+ it "does not say it installed gems from the excluded group" do
+ bundle :install, :without => "emo"
+ out.should_not include("activesupport")
+ end
- it "allows Bundler.setup for specific groups" do
- bundle :install, :without => "emo"
- run("require 'rack'; puts RACK", :default)
- out.should == '1.0.0'
- end
+ it "allows Bundler.setup for specific groups" do
+ bundle :install, :without => "emo"
+ run("require 'rack'; puts RACK", :default)
+ out.should == '1.0.0'
+ end
- it "does not effect the resolve" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- gem "activesupport"
- group :emo do
- gem "rails", "2.3.2"
- end
- G
+ it "does not effect the resolve" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "activesupport"
+ group :emo do
+ gem "rails", "2.3.2"
+ end
+ G
- bundle :install, :without => "emo"
- should_be_installed "activesupport 2.3.2", :groups => [:default]
- end
+ bundle :install, :without => "emo"
+ should_be_installed "activesupport 2.3.2", :groups => [:default]
+ end
- it "still works when locked" do
- bundle :install, :without => "emo"
- bundle :lock
+ it "still works when locked" do
+ bundle :install, :without => "emo"
+ bundle :lock
- simulate_new_machine
- bundle :install, :without => "emo"
+ simulate_new_machine
+ bundle :install, :without => "emo"
- should_be_installed "rack 1.0.0", :groups => [:default]
- should_not_be_installed "activesupport 2.3.5", :groups => [:default]
+ should_be_installed "rack 1.0.0", :groups => [:default]
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
+ end
end
end
end \ No newline at end of file