bundler 1.0.21 → 1.1.rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. data/.travis.yml +7 -0
  2. data/CHANGELOG.md +153 -1
  3. data/README.md +3 -3
  4. data/Rakefile +15 -27
  5. data/bin/bundle +7 -0
  6. data/bundler.gemspec +1 -1
  7. data/lib/bundler/cli.rb +126 -45
  8. data/lib/bundler/definition.rb +22 -5
  9. data/lib/bundler/dep_proxy.rb +35 -0
  10. data/lib/bundler/dsl.rb +17 -34
  11. data/lib/bundler/endpoint_specification.rb +69 -0
  12. data/lib/bundler/fetcher.rb +221 -0
  13. data/lib/bundler/gem_helper.rb +0 -1
  14. data/lib/bundler/gem_helpers.rb +23 -0
  15. data/lib/bundler/index.rb +77 -38
  16. data/lib/bundler/installer.rb +43 -1
  17. data/lib/bundler/man/bundle-benchmark +19 -0
  18. data/lib/bundler/man/bundle-benchmark.txt +27 -0
  19. data/lib/bundler/man/bundle-config +1 -1
  20. data/lib/bundler/man/bundle-config.txt +3 -3
  21. data/lib/bundler/man/bundle-install +288 -0
  22. data/lib/bundler/man/bundle-install.txt +74 -79
  23. data/lib/bundler/man/bundle-package +1 -1
  24. data/lib/bundler/man/bundle-package.txt +1 -1
  25. data/lib/bundler/man/bundle-update +1 -1
  26. data/lib/bundler/man/bundle-update.txt +41 -41
  27. data/lib/bundler/man/gemfile.5 +6 -7
  28. data/lib/bundler/man/gemfile.5.txt +9 -9
  29. data/lib/bundler/match_platform.rb +13 -0
  30. data/lib/bundler/remote_specification.rb +6 -8
  31. data/lib/bundler/resolver.rb +32 -19
  32. data/lib/bundler/rubygems_ext.rb +2 -86
  33. data/lib/bundler/rubygems_integration.rb +35 -0
  34. data/lib/bundler/runtime.rb +84 -1
  35. data/lib/bundler/source.rb +85 -88
  36. data/lib/bundler/spec_set.rb +2 -0
  37. data/lib/bundler/templates/Executable +1 -1
  38. data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  39. data/lib/bundler/templates/newgem/Rakefile.tt +1 -0
  40. data/lib/bundler/templates/newgem/bin/newgem.tt +1 -1
  41. data/lib/bundler/templates/newgem/gitignore.tt +14 -1
  42. data/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -20
  43. data/lib/bundler/ui.rb +32 -17
  44. data/lib/bundler/vendor/net/http/faster.rb +27 -0
  45. data/lib/bundler/vendor/net/http/persistent.rb +468 -0
  46. data/lib/bundler/version.rb +1 -1
  47. data/lib/bundler.rb +56 -23
  48. data/man/bundle-install.ronn +7 -0
  49. data/man/bundle.ronn +3 -0
  50. data/man/gemfile.5.ronn +6 -6
  51. data/spec/bundler/dsl_spec.rb +22 -0
  52. data/spec/bundler/source_spec.rb +25 -0
  53. data/spec/install/deprecated_spec.rb +2 -3
  54. data/spec/install/gems/dependency_api_spec.rb +358 -0
  55. data/spec/install/gems/flex_spec.rb +1 -1
  56. data/spec/install/gems/groups_spec.rb +17 -8
  57. data/spec/install/gems/platform_spec.rb +16 -0
  58. data/spec/install/gems/post_install_spec.rb +47 -0
  59. data/spec/install/gems/simple_case_spec.rb +61 -64
  60. data/spec/install/gems/standalone_spec.rb +238 -0
  61. data/spec/install/git_spec.rb +62 -0
  62. data/spec/other/check_spec.rb +30 -0
  63. data/spec/other/clean_spec.rb +397 -0
  64. data/spec/other/exec_spec.rb +0 -29
  65. data/spec/other/newgem_spec.rb +39 -0
  66. data/spec/other/outdated_spec.rb +93 -0
  67. data/spec/other/show_spec.rb +6 -0
  68. data/spec/quality_spec.rb +1 -1
  69. data/spec/realworld/edgecases_spec.rb +12 -0
  70. data/spec/runtime/executable_spec.rb +10 -0
  71. data/spec/runtime/require_spec.rb +8 -9
  72. data/spec/runtime/with_clean_env_spec.rb +60 -7
  73. data/spec/spec_helper.rb +8 -1
  74. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
  75. data/spec/support/artifice/endpoint.rb +54 -0
  76. data/spec/support/artifice/endpoint_500.rb +37 -0
  77. data/spec/support/artifice/endpoint_api_missing.rb +16 -0
  78. data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
  79. data/spec/support/artifice/endpoint_extra.rb +27 -0
  80. data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
  81. data/spec/support/artifice/endpoint_fallback.rb +18 -0
  82. data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
  83. data/spec/support/artifice/endpoint_redirect.rb +15 -0
  84. data/spec/support/builders.rb +7 -0
  85. data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
  86. data/spec/support/fakeweb/windows.rb +23 -0
  87. data/spec/support/helpers.rb +36 -3
  88. data/spec/support/path.rb +2 -0
  89. data/spec/support/rubygems_ext.rb +3 -3
  90. metadata +48 -74
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'bundle install with gem sources' do
4
+ describe 'when gems include post install messages' do
5
+ it "should display the post-install messages after installing" do
6
+ gemfile <<-G
7
+ source "file://#{gem_repo1}"
8
+ gem 'rack'
9
+ gem 'thin'
10
+ gem 'rack-obama'
11
+ G
12
+
13
+ bundle :install
14
+ out.should include("Post-install message from rack:")
15
+ out.should include("Rack's post install message")
16
+ out.should include("Post-install message from thin:")
17
+ out.should include("Thin's post install message")
18
+ out.should include("Post-install message from rack-obama:")
19
+ out.should include("Rack-obama's post install message")
20
+ end
21
+ end
22
+
23
+ describe 'when gems do not include post install messages' do
24
+ it "should not display any post-install messages" do
25
+ gemfile <<-G
26
+ source "file://#{gem_repo1}"
27
+ gem "activesupport"
28
+ G
29
+
30
+ bundle :install
31
+ out.should_not include("Post-install message")
32
+ end
33
+ end
34
+
35
+ describe "when a dependecy includes a post install message" do
36
+ it "should display the post install message" do
37
+ gemfile <<-G
38
+ source "file://#{gem_repo1}"
39
+ gem 'rack_middleware'
40
+ G
41
+
42
+ bundle :install
43
+ out.should include("Post-install message from rack:")
44
+ out.should include("Rack's post install message")
45
+ end
46
+ end
47
+ end
@@ -293,6 +293,26 @@ describe "bundle install with gem sources" do
293
293
  bundle :install, :expect_err => true
294
294
  out.should =~ /Your Gemfile doesn't have any sources/i
295
295
  end
296
+
297
+ it "creates a Gemfile.lock on a blank Gemfile" do
298
+ install_gemfile <<-G
299
+ G
300
+
301
+ File.exists?(bundled_app("Gemfile.lock")).should be_true
302
+ end
303
+
304
+ it "gracefully handles error when rubygems server is unavailable" do
305
+ install_gemfile <<-G
306
+ source "file://#{gem_repo1}"
307
+ source "http://localhost:9384"
308
+
309
+ gem 'foo'
310
+ G
311
+
312
+ bundle :install
313
+ out.should include("Could not reach http://localhost:9384/")
314
+ out.should_not include("file://")
315
+ end
296
316
  end
297
317
 
298
318
  describe "when prerelease gems are available" do
@@ -466,9 +486,9 @@ describe "bundle install with gem sources" do
466
486
  bundled_app("vendor/bundle").should exist
467
487
  end
468
488
 
469
- it "prints a warning if you try to use --disable-shared-gems" do
470
- bundle "install --path vendor --disable-shared-gems"
471
- out.should include "The disable-shared-gem option is no longer available"
489
+ it "does not use available system gems with bundle --path vendor/bundle" do
490
+ bundle "install --path vendor/bundle"
491
+ should_be_installed "rack 1.0.0"
472
492
  end
473
493
 
474
494
  it "handles paths with regex characters in them" do
@@ -483,37 +503,23 @@ describe "bundle install with gem sources" do
483
503
  dir.rmtree
484
504
  end
485
505
 
486
- ["install vendor/bundle", "install --path vendor/bundle"].each do |install|
487
- if install == "install vendor/bundle"
488
- it "displays the deprecation warning for path as an argument to install" do
489
- bundle install
490
- out.should include("The path argument to `bundle install` is deprecated.")
491
- end
492
- end
493
-
494
- it "does not use available system gems with bundle #{install}" do
495
- bundle install
496
- should_be_installed "rack 1.0.0"
497
- end
498
-
499
- it "prints a warning to let the user know what has happened with bundle #{install}" do
500
- bundle install
501
- out.should include("It was installed into ./vendor")
502
- end
506
+ it "prints a warning to let the user know what has happened with bundle --path vendor/bundle" do
507
+ bundle "install --path vendor/bundle"
508
+ out.should include("It was installed into ./vendor")
509
+ end
503
510
 
504
- it "disallows #{install} --system" do
505
- bundle "#{install} --system"
506
- out.should include("Please choose.")
507
- end
511
+ it "disallows --path vendor/bundle --system" do
512
+ bundle "install --path vendor/bundle --system"
513
+ out.should include("Please choose.")
514
+ end
508
515
 
509
- it "remembers to disable system gems after the first time with bundle #{install}" do
510
- bundle install
511
- FileUtils.rm_rf bundled_app('vendor')
512
- bundle "install"
516
+ it "remembers to disable system gems after the first time with bundle --path vendor/bundle" do
517
+ bundle "install --path vendor/bundle"
518
+ FileUtils.rm_rf bundled_app('vendor')
519
+ bundle "install"
513
520
 
514
- vendored_gems('gems/rack-1.0.0').should be_directory
515
- should_be_installed "rack 1.0.0"
516
- end
521
+ vendored_gems('gems/rack-1.0.0').should be_directory
522
+ should_be_installed "rack 1.0.0"
517
523
  end
518
524
  end
519
525
 
@@ -522,7 +528,7 @@ describe "bundle install with gem sources" do
522
528
  install_gemfile <<-G
523
529
  source "file://#{gem_repo1}"
524
530
  gem "rack"
525
- gem "activesupport", :group => :development
531
+ gem "activesupport", :groups => :development
526
532
  G
527
533
 
528
534
  ruby <<-R
@@ -568,35 +574,6 @@ describe "bundle install with gem sources" do
568
574
  end
569
575
  end
570
576
 
571
- describe "when the gem has an architecture in its platform" do
572
- it "still installs correctly" do
573
- simulate_platform mswin
574
-
575
- gemfile <<-G
576
- # Set up pretend http gem server with FakeWeb
577
- $LOAD_PATH.unshift '#{Dir[base_system_gems.join("gems/fakeweb*/lib")].first}'
578
- require 'fakeweb'
579
- FakeWeb.allow_net_connect = false
580
- files = [ 'specs.4.8.gz',
581
- 'prerelease_specs.4.8.gz',
582
- 'quick/Marshal.4.8/rcov-1.0-mswin32.gemspec.rz',
583
- 'gems/rcov-1.0-mswin32.gem' ]
584
- files.each do |file|
585
- FakeWeb.register_uri(:get, "http://localgemserver.com/\#{file}",
586
- :body => File.read("#{gem_repo1}/\#{file}"))
587
- end
588
- FakeWeb.register_uri(:get, "http://localgemserver.com/gems/rcov-1.0-x86-mswin32.gem",
589
- :status => ["404", "Not Found"])
590
-
591
- # Try to install gem with nil arch
592
- source "http://localgemserver.com/"
593
- gem "rcov"
594
- G
595
- bundle :install
596
- should_be_installed "rcov 1.0.0"
597
- end
598
- end
599
-
600
577
  describe "bundler dependencies" do
601
578
  before(:each) do
602
579
  build_repo2 do
@@ -633,7 +610,7 @@ describe "bundle install with gem sources" do
633
610
  G
634
611
 
635
612
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
636
- Fetching source index for file:#{gem_repo2}/
613
+ Fetching source index from file:#{gem_repo2}/
637
614
  Bundler could not find compatible versions for gem "bundler":
638
615
  In Gemfile:
639
616
  bundler (= 0.9.2) ruby
@@ -690,7 +667,7 @@ describe "bundle install with gem sources" do
690
667
  G
691
668
 
692
669
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
693
- Fetching source index for file:#{gem_repo2}/
670
+ Fetching source index from file:#{gem_repo2}/
694
671
  Bundler could not find compatible versions for gem "activesupport":
695
672
  In Gemfile:
696
673
  activemerchant (>= 0) ruby depends on
@@ -710,7 +687,7 @@ describe "bundle install with gem sources" do
710
687
  G
711
688
 
712
689
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
713
- Fetching source index for file:#{gem_repo2}/
690
+ Fetching source index from file:#{gem_repo2}/
714
691
  Bundler could not find compatible versions for gem "activesupport":
715
692
  In Gemfile:
716
693
  rails_fail (>= 0) ruby depends on
@@ -767,4 +744,24 @@ describe "bundle install with gem sources" do
767
744
  err.should be_empty
768
745
  end
769
746
  end
747
+
748
+ describe "when system_bindir is set" do
749
+ # On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
750
+ # you want to avoid sudo installs for system gems with OS X's default ruby
751
+ it "overrides Gem.bindir" do
752
+ Pathname.new("/usr/bin").should_not be_writable
753
+ gemfile <<-G
754
+ require 'rubygems'
755
+ def Gem.bindir; "/usr/bin"; end
756
+ source "file://#{gem_repo1}"
757
+ gem "rack"
758
+ G
759
+
760
+ config "BUNDLE_SYSTEM_BINDIR" => system_gem_path('altbin').to_s
761
+ bundle :install
762
+ should_be_installed "rack 1.0.0"
763
+ system_gem_path("altbin/rackup").should exist
764
+ end
765
+ end
766
+
770
767
  end
@@ -0,0 +1,238 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install --standalone" do
4
+ describe "with simple gems" do
5
+ before do
6
+ install_gemfile <<-G, :standalone => true
7
+ source "file://#{gem_repo1}"
8
+ gem "rails"
9
+ G
10
+ end
11
+
12
+ it "still makes the gems available to normal bundler" do
13
+ should_be_installed "actionpack 2.3.2", "rails 2.3.2"
14
+ end
15
+
16
+ it "generates a bundle/bundler/setup.rb" do
17
+ bundled_app("bundle/bundler/setup.rb").should exist
18
+ end
19
+
20
+ it "makes the gems available without bundler" do
21
+ ruby <<-RUBY, :no_lib => true
22
+ $:.unshift File.expand_path("bundle")
23
+ require "bundler/setup"
24
+
25
+ require "actionpack"
26
+ puts ACTIONPACK
27
+ RUBY
28
+
29
+ out.should be == "2.3.2"
30
+ end
31
+
32
+ it "works on a different system" do
33
+ FileUtils.mv(bundled_app, "#{bundled_app}2")
34
+ Dir.chdir("#{bundled_app}2")
35
+
36
+ ruby <<-RUBY, :no_lib => true
37
+ $:.unshift File.expand_path("bundle")
38
+ require "bundler/setup"
39
+
40
+ require "actionpack"
41
+ puts ACTIONPACK
42
+ RUBY
43
+
44
+ out.should be == "2.3.2"
45
+ end
46
+ end
47
+
48
+ describe "with a combination of gems and git repos" do
49
+ before do
50
+ build_git "devise", "1.0"
51
+
52
+ install_gemfile <<-G, :standalone => true
53
+ source "file://#{gem_repo1}"
54
+ gem "rails"
55
+ gem "devise", :git => "#{lib_path('devise-1.0')}"
56
+ G
57
+ end
58
+
59
+ it "still makes the gems available to normal bundler" do
60
+ should_be_installed "actionpack 2.3.2", "rails 2.3.2", "devise 1.0"
61
+ end
62
+
63
+ it "generates a bundle/bundler/setup.rb" do
64
+ bundled_app("bundle/bundler/setup.rb").should exist
65
+ end
66
+
67
+ it "makes the gems available without bundler" do
68
+ ruby <<-RUBY, :no_lib => true
69
+ $:.unshift File.expand_path("bundle")
70
+ require "bundler/setup"
71
+
72
+ require "devise"
73
+ require "actionpack"
74
+ puts DEVISE
75
+ puts ACTIONPACK
76
+ RUBY
77
+
78
+ out.should be == "1.0\n2.3.2"
79
+ end
80
+ end
81
+
82
+ describe "with groups" do
83
+ before do
84
+ build_git "devise", "1.0"
85
+
86
+ install_gemfile <<-G, :standalone => true
87
+ source "file://#{gem_repo1}"
88
+ gem "rails"
89
+
90
+ group :test do
91
+ gem "rspec"
92
+ gem "rack-test"
93
+ end
94
+ G
95
+ end
96
+
97
+ it "makes the gems available without bundler" do
98
+ ruby <<-RUBY, :no_lib => true
99
+ $:.unshift File.expand_path("bundle")
100
+ require "bundler/setup"
101
+
102
+ require "actionpack"
103
+ require "spec"
104
+ require "rack/test"
105
+ puts ACTIONPACK
106
+ puts SPEC
107
+ puts RACK_TEST
108
+ RUBY
109
+
110
+ out.should be == "2.3.2\n1.2.7\n1.0"
111
+ end
112
+
113
+ it "allows creating a standalone file with limited groups" do
114
+ bundle "install --standalone default"
115
+
116
+ load_error_ruby <<-RUBY, 'spec', :no_lib => true
117
+ $:.unshift File.expand_path("bundle")
118
+ require "bundler/setup"
119
+
120
+ require "actionpack"
121
+ puts ACTIONPACK
122
+ require "spec"
123
+ RUBY
124
+
125
+ out.should be == "2.3.2"
126
+ err.should == "ZOMG LOAD ERROR"
127
+ end
128
+
129
+ it "allows --without to limit the groups used in a standalone" do
130
+ bundle "install --standalone --without test"
131
+
132
+ load_error_ruby <<-RUBY, 'spec', :no_lib => true
133
+ $:.unshift File.expand_path("bundle")
134
+ require "bundler/setup"
135
+
136
+ require "actionpack"
137
+ puts ACTIONPACK
138
+ require "spec"
139
+ RUBY
140
+
141
+ out.should be == "2.3.2"
142
+ err.should == "ZOMG LOAD ERROR"
143
+ end
144
+
145
+ it "allows --path to change the location of the standalone bundle" do
146
+ bundle "install --standalone --path path/to/bundle"
147
+
148
+ ruby <<-RUBY, :no_lib => true, :expect_err => false
149
+ $:.unshift File.expand_path("path/to/bundle")
150
+ require "bundler/setup"
151
+
152
+ require "actionpack"
153
+ puts ACTIONPACK
154
+ RUBY
155
+
156
+ out.should == "2.3.2"
157
+ end
158
+
159
+ it "allows remembered --without to limit the groups used in a standalone" do
160
+ bundle "install --without test"
161
+ bundle "install --standalone"
162
+
163
+ load_error_ruby <<-RUBY, 'spec', :no_lib => true
164
+ $:.unshift File.expand_path("bundle")
165
+ require "bundler/setup"
166
+
167
+ require "actionpack"
168
+ puts ACTIONPACK
169
+ require "spec"
170
+ RUBY
171
+
172
+ out.should be == "2.3.2"
173
+ err.should == "ZOMG LOAD ERROR"
174
+ end
175
+ end
176
+
177
+ describe "with gemcutter's dependency API" do
178
+ let(:source_uri) { "http://localgemserver.test" }
179
+
180
+ describe "simple gems" do
181
+ before do
182
+ gemfile <<-G
183
+ source "#{source_uri}"
184
+ gem "rails"
185
+ G
186
+ end
187
+
188
+ it "should run without errors" do
189
+ bundle "install --standalone", :artifice => "endpoint", :exitstatus => true
190
+
191
+ @exitstatus.should be == 0
192
+ end
193
+
194
+ it "still makes the gems available to normal bundler" do
195
+ bundle "install --standalone", :artifice => "endpoint"
196
+
197
+ should_be_installed "actionpack 2.3.2", "rails 2.3.2"
198
+ end
199
+
200
+ it "generates a bundle/bundler/setup.rb" do
201
+ bundle "install --standalone", :artifice => "endpoint"
202
+
203
+ bundled_app("bundle/bundler/setup.rb").should exist
204
+ end
205
+
206
+ it "makes the gems available without bundler" do
207
+ bundle "install --standalone", :artifice => "endpoint"
208
+
209
+ ruby <<-RUBY, :no_lib => true
210
+ $:.unshift File.expand_path("bundle")
211
+ require "bundler/setup"
212
+
213
+ require "actionpack"
214
+ puts ACTIONPACK
215
+ RUBY
216
+
217
+ out.should be == "2.3.2"
218
+ end
219
+
220
+ it "works on a different system" do
221
+ bundle "install --standalone", :artifice => "endpoint"
222
+
223
+ FileUtils.mv(bundled_app, "#{bundled_app}2")
224
+ Dir.chdir("#{bundled_app}2")
225
+
226
+ ruby <<-RUBY, :no_lib => true
227
+ $:.unshift File.expand_path("bundle")
228
+ require "bundler/setup"
229
+
230
+ require "actionpack"
231
+ puts ACTIONPACK
232
+ RUBY
233
+
234
+ out.should be == "2.3.2"
235
+ end
236
+ end
237
+ end
238
+ end
@@ -567,4 +567,66 @@ describe "bundle install with git sources" do
567
567
  exitstatus.should == 0
568
568
  end
569
569
  end
570
+
571
+ describe "gem install hooks" do
572
+ it "runs pre-install hooks" do
573
+ build_git "foo"
574
+ gemfile <<-G
575
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
576
+ G
577
+
578
+ File.open(lib_path("install_hooks.rb"), "w") do |h|
579
+ h.write <<-H
580
+ require 'rubygems'
581
+ Gem.pre_install_hooks << lambda do |inst|
582
+ STDERR.puts "Ran pre-install hook: \#{inst.spec.full_name}"
583
+ end
584
+ H
585
+ end
586
+
587
+ bundle :install, :expect_err => true,
588
+ :requires => [lib_path('install_hooks.rb')]
589
+ err.should == "Ran pre-install hook: foo-1.0"
590
+ end
591
+
592
+ it "runs post-install hooks" do
593
+ build_git "foo"
594
+ gemfile <<-G
595
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
596
+ G
597
+
598
+ File.open(lib_path("install_hooks.rb"), "w") do |h|
599
+ h.write <<-H
600
+ require 'rubygems'
601
+ Gem.post_install_hooks << lambda do |inst|
602
+ STDERR.puts "Ran post-install hook: \#{inst.spec.full_name}"
603
+ end
604
+ H
605
+ end
606
+
607
+ bundle :install, :expect_err => true,
608
+ :requires => [lib_path('install_hooks.rb')]
609
+ err.should == "Ran post-install hook: foo-1.0"
610
+ end
611
+
612
+ it "complains if the install hook fails" do
613
+ build_git "foo"
614
+ gemfile <<-G
615
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
616
+ G
617
+
618
+ File.open(lib_path("install_hooks.rb"), "w") do |h|
619
+ h.write <<-H
620
+ require 'rubygems'
621
+ Gem.pre_install_hooks << lambda do |inst|
622
+ false
623
+ end
624
+ H
625
+ end
626
+
627
+ bundle :install, :expect_err => true,
628
+ :requires => [lib_path('install_hooks.rb')]
629
+ err.should include("failed for foo-1.0")
630
+ end
631
+ end
570
632
  end
@@ -179,6 +179,12 @@ describe "bundle check" do
179
179
  out.should include("Could not locate Gemfile")
180
180
  end
181
181
 
182
+ it "does not output fatal error message" do
183
+ bundle :check, :exitstatus => true
184
+ @exitstatus.should eq(10)
185
+ out.should_not include("Unfortunately, a fatal error has occurred. ")
186
+ end
187
+
182
188
  it "should not crash when called multiple times on a new machine" do
183
189
  gemfile <<-G
184
190
  gem 'rails', '3.0.0.beta3'
@@ -195,6 +201,30 @@ describe "bundle check" do
195
201
  end
196
202
  end
197
203
 
204
+ context "--path" do
205
+ before do
206
+ gemfile <<-G
207
+ source "file://#{gem_repo1}"
208
+ gem "rails"
209
+ G
210
+ bundle "install --path vendor/bundle"
211
+
212
+ FileUtils.rm_rf(bundled_app(".bundle"))
213
+ end
214
+
215
+ it "returns success" do
216
+ bundle "check --path vendor/bundle", :exitstatus => true
217
+ @exitstatus.should eq(0)
218
+ out.should == "The Gemfile's dependencies are satisfied"
219
+ end
220
+
221
+ it "should write to .bundle/config" do
222
+ bundle "check --path vendor/bundle", :exitstatus => true
223
+ bundle "check", :exitstatus => true
224
+ @exitstatus.should eq(0)
225
+ end
226
+ end
227
+
198
228
  describe "when locked" do
199
229
  before :each do
200
230
  system_gems "rack-1.0.0"