Permalink
Browse files

WIP

  • Loading branch information...
1 parent 3e63a35 commit 5b7f69566a10369ef1cc6c100f58a0631e74bdc3 Carlhuda committed Aug 12, 2010
@@ -64,7 +64,7 @@
gem "rack-obama"
G
- ENV['BUNDLE_FROZEN'] = '1'
+ env['BUNDLE_FROZEN'] = '1'
bundle "install"
out.should include("You have modified your Gemfile")
out.should include("You have added to the Gemfile")
@@ -18,7 +18,7 @@
end
it "includes the gems when the ENV variable is set" do
- ENV['BUNDLER_TEST'] = '1'
+ env['BUNDLER_TEST'] = '1'
bundle :install
should_be_installed "rack 1.0"
end
@@ -41,7 +41,7 @@
end
it "includes the gems when the ENV variable is set" do
- ENV['BUNDLER_TEST'] = '1'
+ env['BUNDLER_TEST'] = '1'
bundle :install
should_be_installed "rack 1.0"
end
@@ -64,13 +64,13 @@
end
it "excludes the gems when the ENV variable is set but does not match the condition" do
- ENV['BUNDLER_TEST'] = '1'
+ env['BUNDLER_TEST'] = '1'
bundle :install
should_not_be_installed "rack"
end
it "includes the gems when the ENV variable is set and matches the condition" do
- ENV['BUNDLER_TEST'] = 'foo'
+ env['BUNDLER_TEST'] = 'foo'
bundle :install
should_be_installed "rack 1.0"
end
@@ -93,15 +93,15 @@
end
it "excludes the gems when the ENV variable is set but does not match the condition" do
- ENV['BUNDLER_TEST'] = 'fo'
+ env['BUNDLER_TEST'] = 'fo'
bundle :install
should_not_be_installed "rack"
end
it "includes the gems when the ENV variable is set and matches the condition" do
- ENV['BUNDLER_TEST'] = 'foobar'
+ env['BUNDLER_TEST'] = 'foobar'
bundle :install
should_be_installed "rack 1.0"
end
end
-end
+end
@@ -346,7 +346,7 @@
def set_bundle_path(type, location)
if type == :env
- ENV["BUNDLE_PATH"] = location
+ env["BUNDLE_PATH"] = location
elsif type == :global
bundle "config path #{location}", "no-color" => nil
end
@@ -419,7 +419,7 @@ def set_bundle_path(type, location)
bundle :install, :gemfile => bundled_app("NotGemfile")
- ENV['BUNDLE_GEMFILE'] = "NotGemfile"
+ env['BUNDLE_GEMFILE'] = "NotGemfile"
should_be_installed "rack 1.0.0"
end
end
@@ -26,7 +26,7 @@
FileUtils.mkdir_p bundle_path
sudo "chown -R root #{bundle_path}"
- ENV['BUNDLE_PATH'] = bundle_path.to_s
+ env['BUNDLE_PATH'] = bundle_path.to_s
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", '1.0'
View
@@ -71,7 +71,7 @@
bundle "install vendor"
FileUtils.mv bundled_app, tmp('bundled_app.bck')
- Dir.chdir tmp('bundled_app.bck')
+ chdir tmp('bundled_app.bck')
should_be_installed "foo 1.0"
end
@@ -81,7 +81,7 @@
update_git "foo", "1.1", :path => lib_path("foo-1.0")
- Dir.chdir tmp('bundled_app.bck')
+ chdir tmp('bundled_app.bck')
gemfile tmp('bundled_app.bck/Gemfile'), <<-G
source "file://#{gem_repo1}"
git "#{lib_path('foo-1.0')}" do
@@ -25,7 +25,7 @@
it "supports relative paths" do
build_lib "foo"
- relative_path = lib_path('foo-1.0').relative_path_from(Pathname.new(Dir.pwd))
+ relative_path = lib_path('foo-1.0').relative_path_from(Pathname.new(pwd))
install_gemfile <<-G
gem 'foo', :path => "#{relative_path}"
View
@@ -18,7 +18,7 @@
gem "rails"
G
- Dir.chdir tmp
+ chdir tmp
bundle "check --gemfile bundled_app/Gemfile"
out.should == "The Gemfile's dependencies are satisfied"
end
@@ -29,7 +29,7 @@
gem "rails"
G
- FileUtils.rm("Gemfile.lock")
+ rm("Gemfile.lock")
bundle "check"
@@ -9,7 +9,7 @@
end
it "can be moved with an environment variable" do
- ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
+ env['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
bundle "install vendor"
bundled_app('.bundle').should_not exist
@@ -21,7 +21,7 @@
FileUtils.mkdir_p bundled_app('omg')
Dir.chdir bundled_app('omg')
- ENV['BUNDLE_APP_CONFIG'] = "../foo"
+ env['BUNDLE_APP_CONFIG'] = "../foo"
bundle "install vendor"
bundled_app(".bundle").should_not exist
@@ -31,7 +31,7 @@
it "removes environment.rb from BUNDLE_APP_CONFIG's path" do
FileUtils.mkdir_p(tmp('foo/bar'))
- ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
+ env['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
bundle "install"
FileUtils.touch tmp('foo/bar/environment.rb')
should_be_installed "rack 1.0.0"
View
@@ -45,21 +45,20 @@
gem "rack", "0.9.1"
G
- Dir.chdir bundled_app2 do
- install_gemfile bundled_app2('Gemfile'), <<-G
- source "file://#{gem_repo2}"
- gem "rack_two", "1.0.0"
- G
- end
+ chdir bundled_app2
+ install_gemfile bundled_app2('Gemfile'), <<-G
+ source "file://#{gem_repo2}"
+ gem "rack_two", "1.0.0"
+ G
+ chdir bundled_app
bundle "exec rackup"
check out.should == "0.9.1"
- Dir.chdir bundled_app2 do
- bundle "exec rackup"
- out.should == "1.0.0"
- end
+ chdir bundled_app2
+ bundle "exec rackup"
+ out.should == "1.0.0"
end
it "handles gems installed with --without" do
View
@@ -9,15 +9,15 @@
end
it "creates a Gemfile.lock if one did not exist" do
- FileUtils.rm("Gemfile.lock")
+ rm("Gemfile.lock")
bundle "show"
bundled_app("Gemfile.lock").should exist
end
it "creates a Gemfile.lock if one did not exist and we're doing bundle show rails" do
- FileUtils.rm("Gemfile.lock")
+ rm("Gemfile.lock")
bundle "show rails"
@@ -17,4 +17,4 @@
should_resolve_as %w(actionpack-2.3.5 activesupport-2.3.5 rack-1.0)
end
-end
+end
View
@@ -18,8 +18,8 @@
gem "rack"
G
- env = Bundler.load
- env.dependencies.should have_dep("rack", ">= 0")
+ run "deps = Bundler.load.dependencies; puts deps.any? { |d| d == Gem::Dependency.new('rack', '>=0') }"
+ out.should == "true"
end
it "provides a list of the resolved gems" do
@@ -28,8 +28,8 @@
gem "rack"
G
- env = Bundler.load
- env.gems.should have_gem("rack-1.0.0", "bundler-#{Bundler::VERSION}")
+ run "gems = Bundler.load.gems; puts gems.length && gems.any? { |a| a.full_name == 'rack-1.0.0' }"
+ out.should == "true"
end
it "raises an exception if the default gemfile is not found" do
@@ -39,10 +39,9 @@
end
it "raises an exception if a specified gemfile is not found" do
- lambda {
- ENV['BUNDLE_GEMFILE'] = "omg.rb"
- Bundler.load
- }.should raise_error(Bundler::GemfileNotFound, /omg\.rb/)
+ env['BUNDLE_GEMFILE'] = "omg.rb"
+ run "Bundler.load", :expect_err => true
+ err.should =~ /omg\.rb/
end
describe "when called twice" do
@@ -97,10 +96,8 @@
gem "activerecord"
G
- Bundler.load.specs.each do |spec|
- spec.to_yaml.should_not =~ /^\s+source:/
- spec.to_yaml.should_not =~ /^\s+groups:/
- end
+ run "specs = Bundler.load.specs; puts specs.all? { |s| s.to_yaml !~ /^\s+(source|groups):/ }"
+ out.should == "true"
end
end
View
@@ -87,14 +87,14 @@
gem "activesupport", "2.3.5"
G
- ENV['BUNDLE_GEMFILE'] = bundled_app('4realz').to_s
+ env['BUNDLE_GEMFILE'] = bundled_app('4realz').to_s
bundle :install
should_be_installed "activesupport 2.3.5"
end
it "prioritizes gems in BUNDLE_PATH over gems in GEM_HOME" do
- ENV['BUNDLE_PATH'] = bundled_app('.bundle').to_s
+ env['BUNDLE_PATH'] = bundled_app('.bundle').to_s
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "rack", "1.0.0"
@@ -246,14 +246,14 @@
begin
bundle "install vendor"
- Dir["**/*"].each do |f|
+ Dir["#{pwd}/**/*"].each do |f|
File.directory?(f) ?
File.chmod(0555, f) :
File.chmod(0444, f)
end
should_be_installed "rack 1.0.0"
ensure
- Dir["**/*"].each do |f|
+ Dir["#{pwd}/**/*"].each do |f|
File.directory?(f) ?
File.chmod(0755, f) :
File.chmod(0644, f)
@@ -370,7 +370,7 @@
gem "rack"
G
- ENV["GEM_HOME"] = ""
+ env["GEM_HOME"] = ""
bundle %{exec ruby -e "require 'set'"}
err.should be_empty
@@ -3,13 +3,28 @@
describe "Bundler.with_clean_env" do
it "should reset and restore the environment" do
- gem_path = ENV['GEM_PATH']
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
- Bundler.with_clean_env do
- `echo $GEM_PATH`.strip.should_not == gem_path
- end
+ bundle "install --path vendor"
+ puts out
- ENV['GEM_PATH'].should == gem_path
+ env["GEM_HOME"] = "omg"
+
+ run <<-RUBY
+ puts ENV['GEM_HOME']
+
+ Bundler.with_clean_env do
+ puts `echo $GEM_HOME`.strip
+ end
+
+ puts ENV['GEM_HOME'].strip
+ RUBY
+
+ home = File.expand_path(vendored_gems)
+ out.should == "#{home}\nomg\n#{home}"
end
-end
+end
Oops, something went wrong.

0 comments on commit 5b7f695

Please sign in to comment.