bundler 1.2.5 → 1.3.0.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

Files changed (124) hide show
  1. data/.gitignore +10 -7
  2. data/.travis.yml +12 -3
  3. data/CHANGELOG.md +26 -19
  4. data/CONTRIBUTE.md +97 -0
  5. data/README.md +4 -2
  6. data/Rakefile +17 -59
  7. data/bundler.gemspec +2 -1
  8. data/lib/bundler.rb +23 -20
  9. data/lib/bundler/cli.rb +68 -22
  10. data/lib/bundler/definition.rb +3 -2
  11. data/lib/bundler/deprecate.rb +15 -0
  12. data/lib/bundler/dsl.rb +14 -16
  13. data/lib/bundler/environment.rb +0 -5
  14. data/lib/bundler/fetcher.rb +23 -78
  15. data/lib/bundler/friendly_errors.rb +4 -5
  16. data/lib/bundler/gem_helper.rb +14 -16
  17. data/lib/bundler/injector.rb +64 -0
  18. data/lib/bundler/installer.rb +1 -7
  19. data/lib/bundler/lazy_specification.rb +6 -3
  20. data/lib/bundler/lockfile_parser.rb +25 -13
  21. data/lib/bundler/resolver.rb +0 -1
  22. data/lib/bundler/rubygems_integration.rb +83 -17
  23. data/lib/bundler/settings.rb +4 -2
  24. data/lib/bundler/similarity_detector.rb +63 -0
  25. data/lib/bundler/source.rb +3 -886
  26. data/lib/bundler/source/git.rb +267 -0
  27. data/lib/bundler/source/git/git_proxy.rb +142 -0
  28. data/lib/bundler/source/path.rb +209 -0
  29. data/lib/bundler/source/path/installer.rb +33 -0
  30. data/lib/bundler/source/rubygems.rb +261 -0
  31. data/lib/bundler/templates/newgem/newgem.gemspec.tt +3 -0
  32. data/lib/bundler/templates/newgem/rspec.tt +2 -0
  33. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +9 -0
  34. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
  35. data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
  36. data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
  37. data/lib/bundler/ui.rb +20 -5
  38. data/lib/bundler/vendor/.document +0 -0
  39. data/lib/bundler/vendor/thor.rb +74 -5
  40. data/lib/bundler/vendor/thor/actions.rb +5 -5
  41. data/lib/bundler/vendor/thor/actions/directory.rb +1 -0
  42. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +7 -1
  43. data/lib/bundler/vendor/thor/base.rb +44 -11
  44. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +5 -0
  45. data/lib/bundler/vendor/thor/parser/argument.rb +14 -7
  46. data/lib/bundler/vendor/thor/parser/arguments.rb +7 -1
  47. data/lib/bundler/vendor/thor/parser/option.rb +8 -8
  48. data/lib/bundler/vendor/thor/parser/options.rb +62 -24
  49. data/lib/bundler/vendor/thor/runner.rb +1 -1
  50. data/lib/bundler/vendor/thor/shell/basic.rb +2 -2
  51. data/lib/bundler/vendor/thor/task.rb +2 -2
  52. data/lib/bundler/vendor/thor/version.rb +1 -1
  53. data/lib/bundler/vendored_persistent.rb +3 -15
  54. data/lib/bundler/version.rb +1 -1
  55. data/man/bundle-exec.ronn +1 -1
  56. data/man/bundle-update.ronn +1 -1
  57. data/man/bundle.ronn +4 -1
  58. data/spec/bundler/bundler_spec.rb +2 -28
  59. data/spec/bundler/cli_rspec.rb +9 -0
  60. data/spec/bundler/definition_spec.rb +1 -1
  61. data/spec/bundler/dsl_spec.rb +15 -8
  62. data/spec/bundler/gem_helper_spec.rb +38 -21
  63. data/spec/bundler/psyched_yaml_spec.rb +1 -0
  64. data/spec/bundler/source_spec.rb +3 -3
  65. data/spec/cache/gems_spec.rb +24 -24
  66. data/spec/cache/git_spec.rb +21 -23
  67. data/spec/cache/path_spec.rb +11 -11
  68. data/spec/cache/platform_spec.rb +6 -6
  69. data/spec/install/deploy_spec.rb +38 -38
  70. data/spec/install/gems/c_ext_spec.rb +2 -2
  71. data/spec/install/gems/dependency_api_spec.rb +23 -116
  72. data/spec/install/gems/env_spec.rb +1 -1
  73. data/spec/install/gems/flex_spec.rb +7 -8
  74. data/spec/install/gems/groups_spec.rb +10 -10
  75. data/spec/install/gems/packed_spec.rb +4 -4
  76. data/spec/install/gems/platform_spec.rb +3 -3
  77. data/spec/install/gems/post_install_spec.rb +9 -9
  78. data/spec/install/gems/resolving_spec.rb +2 -2
  79. data/spec/install/gems/simple_case_spec.rb +50 -53
  80. data/spec/install/gems/standalone_spec.rb +19 -19
  81. data/spec/install/gems/sudo_spec.rb +31 -16
  82. data/spec/install/gems/win32_spec.rb +1 -1
  83. data/spec/install/gemspec_spec.rb +6 -6
  84. data/spec/install/git_spec.rb +34 -34
  85. data/spec/install/invalid_spec.rb +3 -3
  86. data/spec/install/path_spec.rb +71 -8
  87. data/spec/install/upgrade_spec.rb +2 -2
  88. data/spec/integration/inject.rb +78 -0
  89. data/spec/lock/git_spec.rb +2 -2
  90. data/spec/lock/lockfile_spec.rb +14 -14
  91. data/spec/other/check_spec.rb +29 -29
  92. data/spec/other/clean_spec.rb +47 -48
  93. data/spec/other/config_spec.rb +20 -20
  94. data/spec/other/console_spec.rb +5 -5
  95. data/spec/other/exec_spec.rb +48 -28
  96. data/spec/other/ext_spec.rb +3 -3
  97. data/spec/other/help_spec.rb +6 -6
  98. data/spec/other/init_spec.rb +8 -8
  99. data/spec/other/newgem_spec.rb +95 -15
  100. data/spec/other/open_spec.rb +10 -5
  101. data/spec/other/outdated_spec.rb +8 -8
  102. data/spec/other/platform_spec.rb +45 -45
  103. data/spec/other/show_spec.rb +10 -10
  104. data/spec/quality_spec.rb +2 -2
  105. data/spec/realworld/dependency_api_spec.rb +61 -0
  106. data/spec/realworld/edgecases_spec.rb +8 -8
  107. data/spec/runtime/executable_spec.rb +13 -13
  108. data/spec/runtime/load_spec.rb +12 -12
  109. data/spec/runtime/platform_spec.rb +1 -1
  110. data/spec/runtime/require_spec.rb +24 -24
  111. data/spec/runtime/setup_spec.rb +113 -56
  112. data/spec/runtime/with_clean_env_spec.rb +11 -13
  113. data/spec/spec_helper.rb +6 -0
  114. data/spec/support/artifice/endpoint.rb +28 -13
  115. data/spec/support/artifice/endpoint_extra.rb +4 -0
  116. data/spec/support/builders.rb +1 -1
  117. data/spec/support/helpers.rb +2 -7
  118. data/spec/support/indexes.rb +3 -3
  119. data/spec/support/matchers.rb +6 -6
  120. data/spec/update/gems_spec.rb +19 -8
  121. data/spec/update/git_spec.rb +10 -10
  122. data/spec/update/source_spec.rb +1 -1
  123. metadata +86 -55
  124. data/.rspec +0 -2
@@ -16,8 +16,8 @@ describe "Bundler.setup" do
16
16
  require 'rack'
17
17
  puts RACK
18
18
  RUBY
19
- err.should eq("")
20
- out.should eq("1.0.0")
19
+ expect(err).to eq("")
20
+ expect(out).to eq("1.0.0")
21
21
  end
22
22
  end
23
23
 
@@ -42,8 +42,8 @@ describe "Bundler.setup" do
42
42
  puts "WIN"
43
43
  end
44
44
  RUBY
45
- err.should eq("")
46
- out.should eq("WIN")
45
+ expect(err).to eq("")
46
+ expect(out).to eq("WIN")
47
47
  end
48
48
 
49
49
  it "leaves all groups available if they were already" do
@@ -56,8 +56,8 @@ describe "Bundler.setup" do
56
56
  require 'rack'
57
57
  puts RACK
58
58
  RUBY
59
- err.should eq("")
60
- out.should eq("1.0.0")
59
+ expect(err).to eq("")
60
+ expect(out).to eq("1.0.0")
61
61
  end
62
62
 
63
63
  it "leaves :default available if setup is called twice" do
@@ -74,8 +74,8 @@ describe "Bundler.setup" do
74
74
  puts "FAIL"
75
75
  end
76
76
  RUBY
77
- err.should eq("")
78
- out.should match("WIN")
77
+ expect(err).to eq("")
78
+ expect(out).to match("WIN")
79
79
  end
80
80
  end
81
81
 
@@ -97,7 +97,7 @@ describe "Bundler.setup" do
97
97
  end
98
98
  R
99
99
 
100
- out.should == "WIN"
100
+ expect(out).to eq("WIN")
101
101
  end
102
102
 
103
103
  it "doesn't create a Gemfile.lock if the setup fails" do
@@ -113,7 +113,7 @@ describe "Bundler.setup" do
113
113
  Bundler.setup
114
114
  R
115
115
 
116
- bundled_app("Gemfile.lock").should_not exist
116
+ expect(bundled_app("Gemfile.lock")).not_to exist
117
117
  end
118
118
 
119
119
  it "doesn't change the Gemfile.lock if the setup fails" do
@@ -137,7 +137,7 @@ describe "Bundler.setup" do
137
137
  Bundler.setup
138
138
  R
139
139
 
140
- File.read(bundled_app("Gemfile.lock")).should == lockfile
140
+ expect(File.read(bundled_app("Gemfile.lock"))).to eq(lockfile)
141
141
  end
142
142
 
143
143
  it "makes a Gemfile.lock if setup succeeds" do
@@ -151,7 +151,7 @@ describe "Bundler.setup" do
151
151
  FileUtils.rm(bundled_app("Gemfile.lock"))
152
152
 
153
153
  run "1"
154
- bundled_app("Gemfile.lock").should exist
154
+ expect(bundled_app("Gemfile.lock")).to exist
155
155
  end
156
156
 
157
157
  it "uses BUNDLE_GEMFILE to locate the gemfile if present" do
@@ -204,7 +204,7 @@ describe "Bundler.setup" do
204
204
  end
205
205
  R
206
206
 
207
- out.should == "WIN"
207
+ expect(out).to eq("WIN")
208
208
  end
209
209
 
210
210
  it "version_requirement is now deprecated in rubygems 1.4.0+ when gem is missing" do
@@ -217,7 +217,7 @@ describe "Bundler.setup" do
217
217
  end
218
218
  R
219
219
 
220
- err.should be_empty
220
+ expect(err).to be_empty
221
221
  end
222
222
 
223
223
  it "replaces #gem but raises when the version is wrong" do
@@ -230,7 +230,7 @@ describe "Bundler.setup" do
230
230
  end
231
231
  R
232
232
 
233
- out.should == "WIN"
233
+ expect(out).to eq("WIN")
234
234
  end
235
235
 
236
236
  it "version_requirement is now deprecated in rubygems 1.4.0+ when the version is wrong" do
@@ -243,7 +243,7 @@ describe "Bundler.setup" do
243
243
  end
244
244
  R
245
245
 
246
- err.should be_empty
246
+ expect(err).to be_empty
247
247
  end
248
248
  end
249
249
 
@@ -258,14 +258,14 @@ describe "Bundler.setup" do
258
258
 
259
259
  it "removes system gems from Gem.source_index" do
260
260
  run "require 'yard'"
261
- out.should == "bundler-#{Bundler::VERSION}\nyard-1.0"
261
+ expect(out).to eq("bundler-#{Bundler::VERSION}\nyard-1.0")
262
262
  end
263
263
 
264
264
  context "when the ruby stdlib is a substring of Gem.path" do
265
265
  it "does not reject the stdlib from $LOAD_PATH" do
266
266
  substring = "/" + $LOAD_PATH.find{|p| p =~ /vendor_ruby/ }.split("/")[2]
267
267
  run "puts 'worked!'", :env => {"GEM_PATH" => substring}
268
- out.should == "worked!"
268
+ expect(out).to eq("worked!")
269
269
  end
270
270
  end
271
271
  end
@@ -286,7 +286,7 @@ describe "Bundler.setup" do
286
286
  G
287
287
 
288
288
  run "require 'rack'"
289
- out.should == "WIN"
289
+ expect(out).to eq("WIN")
290
290
  end
291
291
  end
292
292
 
@@ -301,7 +301,7 @@ describe "Bundler.setup" do
301
301
 
302
302
  it "provides a useful exception when the git repo is not checked out yet" do
303
303
  run "1", :expect_err => true
304
- err.should include("#{lib_path('rack-1.0.0')} (at master) is not checked out. Please run `bundle install`")
304
+ expect(err).to include("#{lib_path('rack-1.0.0')} (at master) is not checked out. Please run `bundle install`")
305
305
  end
306
306
 
307
307
  it "does not hit the git binary if the lockfile is available and up to date" do
@@ -321,7 +321,7 @@ describe "Bundler.setup" do
321
321
  end
322
322
  R
323
323
 
324
- out.should == "WIN"
324
+ expect(out).to eq("WIN")
325
325
  end
326
326
 
327
327
  it "provides a good exception if the lockfile is unavailable" do
@@ -345,7 +345,7 @@ describe "Bundler.setup" do
345
345
 
346
346
  run "puts 'FAIL'", :expect_err => true
347
347
 
348
- err.should_not include "This is not the git you are looking for"
348
+ expect(err).not_to include "This is not the git you are looking for"
349
349
  end
350
350
 
351
351
  it "works even when the cache directory has been deleted" do
@@ -387,11 +387,11 @@ describe "Bundler.setup" do
387
387
 
388
388
  bundle %|config local.rack #{lib_path('local-rack')}|
389
389
  bundle :install
390
- out.should =~ /at #{lib_path('local-rack')}/
390
+ expect(out).to match(/at #{lib_path('local-rack')}/)
391
391
 
392
392
  FileUtils.rm_rf(lib_path('local-rack'))
393
- run "require 'rack'"
394
- err.should =~ /Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/
393
+ run "require 'rack'", :expect_err => true
394
+ expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
395
395
  end
396
396
 
397
397
  it "explodes if branch is not given on runtime" do
@@ -406,15 +406,15 @@ describe "Bundler.setup" do
406
406
 
407
407
  bundle %|config local.rack #{lib_path('local-rack')}|
408
408
  bundle :install
409
- out.should =~ /at #{lib_path('local-rack')}/
409
+ expect(out).to match(/at #{lib_path('local-rack')}/)
410
410
 
411
411
  gemfile <<-G
412
412
  source "file://#{gem_repo1}"
413
413
  gem "rack", :git => "#{lib_path('rack-0.8')}"
414
414
  G
415
415
 
416
- run "require 'rack'"
417
- err.should =~ /because :branch is not specified in Gemfile/
416
+ run "require 'rack'", :expect_err => true
417
+ expect(err).to match(/because :branch is not specified in Gemfile/)
418
418
  end
419
419
 
420
420
  it "explodes on different branches on runtime" do
@@ -429,15 +429,15 @@ describe "Bundler.setup" do
429
429
 
430
430
  bundle %|config local.rack #{lib_path('local-rack')}|
431
431
  bundle :install
432
- out.should =~ /at #{lib_path('local-rack')}/
432
+ expect(out).to match(/at #{lib_path('local-rack')}/)
433
433
 
434
434
  gemfile <<-G
435
435
  source "file://#{gem_repo1}"
436
436
  gem "rack", :git => "#{lib_path('rack-0.8')}", :branch => "changed"
437
437
  G
438
438
 
439
- run "require 'rack'"
440
- err.should =~ /is using branch master but Gemfile specifies changed/
439
+ run "require 'rack'", :expect_err => true
440
+ expect(err).to match(/is using branch master but Gemfile specifies changed/)
441
441
  end
442
442
 
443
443
  it "explodes on refs with different branches on runtime" do
@@ -456,8 +456,8 @@ describe "Bundler.setup" do
456
456
  G
457
457
 
458
458
  bundle %|config local.rack #{lib_path('local-rack')}|
459
- run "require 'rack'"
460
- err.should =~ /is using branch master but Gemfile specifies nonexistant/
459
+ run "require 'rack'", :expect_err => true
460
+ expect(err).to match(/is using branch master but Gemfile specifies nonexistant/)
461
461
  end
462
462
  end
463
463
 
@@ -537,7 +537,7 @@ describe "Bundler.setup" do
537
537
  end
538
538
  R
539
539
 
540
- out.should == "You have already activated thin 1.1, but your Gemfile requires thin 1.0. Using bundle exec may solve this."
540
+ expect(out).to eq("You have already activated thin 1.1, but your Gemfile requires thin 1.0. Using bundle exec may solve this.")
541
541
  end
542
542
 
543
543
  it "version_requirement is now deprecated in rubygems 1.4.0+" do
@@ -562,7 +562,7 @@ describe "Bundler.setup" do
562
562
  end
563
563
  R
564
564
 
565
- err.should be_empty
565
+ expect(err).to be_empty
566
566
  end
567
567
  end
568
568
  end
@@ -585,7 +585,7 @@ describe "Bundler.setup" do
585
585
  end
586
586
  R
587
587
 
588
- out.should be_empty
588
+ expect(out).to be_empty
589
589
  end
590
590
 
591
591
  it "ignores empty gem paths" do
@@ -597,7 +597,7 @@ describe "Bundler.setup" do
597
597
  ENV["GEM_HOME"] = ""
598
598
  bundle %{exec ruby -e "require 'set'"}
599
599
 
600
- err.should be_empty
600
+ expect(err).to be_empty
601
601
  end
602
602
 
603
603
  it "should prepend gemspec require paths to $LOAD_PATH in order" do
@@ -615,7 +615,7 @@ describe "Bundler.setup" do
615
615
  G
616
616
 
617
617
  run "require 'rq'"
618
- out.should == "yay"
618
+ expect(out).to eq("yay")
619
619
  end
620
620
 
621
621
  it "ignores Gem.refresh" do
@@ -631,7 +631,7 @@ describe "Bundler.setup" do
631
631
  puts Bundler.rubygems.find_name("rack").inspect
632
632
  R
633
633
 
634
- out.should == "[]"
634
+ expect(out).to eq("[]")
635
635
  end
636
636
 
637
637
  describe "when a vendored gem specification uses the :path option" do
@@ -652,7 +652,7 @@ describe "Bundler.setup" do
652
652
  require 'foo'
653
653
  R
654
654
  end
655
- err.should == ""
655
+ expect(err).to eq("")
656
656
  end
657
657
 
658
658
  it "should make sure the Bundler.root is really included in the path relative to the Gemfile" do
@@ -677,7 +677,7 @@ describe "Bundler.setup" do
677
677
  R
678
678
  end
679
679
 
680
- err.should == ""
680
+ expect(err).to eq("")
681
681
  end
682
682
  end
683
683
 
@@ -696,7 +696,7 @@ describe "Bundler.setup" do
696
696
  puts NOGEMSPEC
697
697
  R
698
698
 
699
- out.should == "1.0"
699
+ expect(out).to eq("1.0")
700
700
  end
701
701
  end
702
702
 
@@ -722,7 +722,7 @@ describe "Bundler.setup" do
722
722
  end
723
723
  R
724
724
 
725
- out.should == "WIN"
725
+ expect(out).to eq("WIN")
726
726
  end
727
727
 
728
728
  it "provides a gem method" do
@@ -732,7 +732,7 @@ describe "Bundler.setup" do
732
732
  puts ACTIVESUPPORT
733
733
  R
734
734
 
735
- out.should == "2.3.5"
735
+ expect(out).to eq("2.3.5")
736
736
  end
737
737
 
738
738
  it "raises an exception if gem is used to invoke a system gem not in the bundle" do
@@ -744,12 +744,12 @@ describe "Bundler.setup" do
744
744
  end
745
745
  R
746
746
 
747
- out.should == "rack is not part of the bundle. Add it to Gemfile."
747
+ expect(out).to eq("rack is not part of the bundle. Add it to Gemfile.")
748
748
  end
749
749
 
750
750
  it "sets GEM_HOME appropriately" do
751
751
  run "puts ENV['GEM_HOME']"
752
- out.should == default_bundle_path.to_s
752
+ expect(out).to eq(default_bundle_path.to_s)
753
753
  end
754
754
  end
755
755
 
@@ -767,8 +767,8 @@ describe "Bundler.setup" do
767
767
  it "sets GEM_PATH appropriately" do
768
768
  run "puts Gem.path"
769
769
  paths = out.split("\n")
770
- paths.should include(system_gem_path.to_s)
771
- paths.should include(default_bundle_path.to_s)
770
+ expect(paths).to include(system_gem_path.to_s)
771
+ expect(paths).to include(default_bundle_path.to_s)
772
772
  end
773
773
  end
774
774
 
@@ -798,7 +798,7 @@ describe "Bundler.setup" do
798
798
  it "evals each gemspec in the context of its parent directory" do
799
799
  bundle :install
800
800
  run "require 'bar'; puts BAR"
801
- out.should == "1.0"
801
+ expect(out).to eq("1.0")
802
802
  end
803
803
 
804
804
  it "error intelligently if the gemspec has a LoadError" do
@@ -806,10 +806,10 @@ describe "Bundler.setup" do
806
806
  s.write "bar.gemspec", "require 'foobarbaz'"
807
807
  end
808
808
  bundle :install
809
- out.should include("was a LoadError while evaluating bar.gemspec")
810
- out.should include("foobarbaz")
811
- out.should include("bar.gemspec:1")
812
- out.should include("try to require a relative path") if RUBY_VERSION >= "1.9"
809
+ expect(out).to include("was a LoadError while evaluating bar.gemspec")
810
+ expect(out).to include("foobarbaz")
811
+ expect(out).to include("bar.gemspec:1")
812
+ expect(out).to include("try to require a relative path") if RUBY_VERSION >= "1.9"
813
813
  end
814
814
 
815
815
  it "evals each gemspec with a binding from the top level" do
@@ -823,8 +823,8 @@ describe "Bundler.setup" do
823
823
  Bundler.load
824
824
  RUBY
825
825
 
826
- err.should eq("")
827
- out.should eq("")
826
+ expect(err).to eq("")
827
+ expect(out).to eq("")
828
828
  end
829
829
  end
830
830
 
@@ -835,8 +835,65 @@ describe "Bundler.setup" do
835
835
  G
836
836
 
837
837
  bundle %|exec ruby -e "require 'bundler'; Bundler.setup"|
838
- err.should be_empty
838
+ expect(err).to be_empty
839
839
  end
840
840
  end
841
841
 
842
+ context "when using Syck as YAML::Engine", :ruby => "1.9" do
843
+ it "should try to eval gemspec after YAML load throws ArgumentError" do
844
+ orig_yamler = YAML::ENGINE.yamler
845
+ YAML::ENGINE.yamler = 'syck'
846
+
847
+ spec_file = tmp.join('temp_gemspec_to_be_loaded_with_yaml_syck')
848
+ File.open(spec_file, 'w') do |file|
849
+ file << strip_whitespace(<<-S)
850
+ --- # -*- encoding: utf-8 -*-
851
+ spec = Gem::Specification.new do |s|
852
+ s.name = 'test'
853
+ s.summary = %q{TODO: Write a gem summary}
854
+ s.description = %q{TODO: Write a gem description}
855
+ s.add_dependency 'rack', '= 1.0.1'
856
+ s.add_development_dependency 'rspec', '1.2'
857
+ end
858
+ S
859
+ end
860
+
861
+ # <ArgumentError: syntax error on line 4, col 26: ` s.description = %q{TODO: Write a gem description}'>
862
+ # should be thrown here, tried to be evaled and then fail with NoMethodError
863
+ expect {
864
+ Bundler.load_gemspec_uncached(tmp('temp_gemspec_to_be_loaded_with_yaml_syck'))
865
+ }.to raise_error(NoMethodError)
866
+
867
+ YAML::ENGINE.yamler = orig_yamler
868
+ end
869
+ end
870
+
871
+ context "when using Psych as YAML::Engine", :ruby => "1.9" do
872
+ it "should try to eval gemspec after YAML load throws Psych::SyntaxError" do
873
+ orig_yamler = YAML::ENGINE.yamler
874
+ YAML::ENGINE.yamler = 'psych'
875
+
876
+ spec_file = tmp.join('temp_gemspec_to_be_loaded_with_yaml_psych')
877
+ File.open(spec_file, 'w') do |file|
878
+ file << strip_whitespace(<<-S)
879
+ --- # -*- encoding: utf-8 -*-
880
+ Gem::Specification.new do |s|
881
+ s.name = 'test'
882
+ s.summary = "TODO: Write a gem summary"
883
+ s.description = "TODO: Write a gem description"
884
+ s.add_dependency 'rack', '= 1.0.1'
885
+ s.add_development_dependency 'rspec', '1.2'
886
+ end
887
+ S
888
+ end
889
+
890
+ # <Psych::SyntaxError: couldn't parse YAML at line 4 column 23>
891
+ # should be thrown here, tried to be evaled and then fail with NoMethodError
892
+ expect {
893
+ Bundler.load_gemspec_uncached(tmp('temp_gemspec_to_be_loaded_with_yaml_psych'))
894
+ }.to raise_error(NoMethodError)
895
+
896
+ YAML::ENGINE.yamler = orig_yamler
897
+ end
898
+ end
842
899
  end
@@ -7,10 +7,10 @@ describe "Bundler.with_env helpers" do
7
7
  gem_path = ENV['GEM_PATH']
8
8
 
9
9
  Bundler.with_clean_env do
10
- `echo $GEM_PATH`.strip.should_not == gem_path
10
+ expect(`echo $GEM_PATH`.strip).not_to eq(gem_path)
11
11
  end
12
12
 
13
- ENV['GEM_PATH'].should == gem_path
13
+ expect(ENV['GEM_PATH']).to eq(gem_path)
14
14
  end
15
15
  end
16
16
 
@@ -29,19 +29,17 @@ describe "Bundler.with_env helpers" do
29
29
  gemfile ""
30
30
  bundle "install --path vendor/bundle"
31
31
 
32
- gem_path = ENV['GEM_PATH']
33
-
34
32
  code = "Bundler.with_clean_env do;" +
35
33
  " print ENV['GEM_PATH'] != '';" +
36
34
  "end"
37
35
 
38
36
  result = bundle "exec ruby -e #{code.inspect}"
39
- result.should == "true"
37
+ expect(result).to eq("true")
40
38
  end
41
39
 
42
40
  it "should not pass any bundler environment variables" do
43
41
  Bundler.with_clean_env do
44
- `echo $BUNDLE_PATH`.strip.should_not == './Gemfile'
42
+ expect(`echo $BUNDLE_PATH`.strip).not_to eq('./Gemfile')
45
43
  end
46
44
  end
47
45
 
@@ -50,15 +48,15 @@ describe "Bundler.with_env helpers" do
50
48
  Bundler::ORIGINAL_ENV['RUBYOPT'] = " -I#{lib_path} -rbundler/setup"
51
49
 
52
50
  Bundler.with_clean_env do
53
- `echo $RUBYOPT`.strip.should_not include '-rbundler/setup'
54
- `echo $RUBYOPT`.strip.should_not include "-I#{lib_path}"
51
+ expect(`echo $RUBYOPT`.strip).not_to include '-rbundler/setup'
52
+ expect(`echo $RUBYOPT`.strip).not_to include "-I#{lib_path}"
55
53
  end
56
54
 
57
- Bundler::ORIGINAL_ENV['RUBYOPT'].should == " -I#{lib_path} -rbundler/setup"
55
+ expect(Bundler::ORIGINAL_ENV['RUBYOPT']).to eq(" -I#{lib_path} -rbundler/setup")
58
56
  end
59
57
 
60
58
  it "should not change ORIGINAL_ENV" do
61
- Bundler::ORIGINAL_ENV['BUNDLE_PATH'].should == './Gemfile'
59
+ expect(Bundler::ORIGINAL_ENV['BUNDLE_PATH']).to eq('./Gemfile')
62
60
  end
63
61
 
64
62
  end
@@ -69,7 +67,7 @@ describe "Bundler.with_env helpers" do
69
67
 
70
68
  it "should pass bundler environment variables set before Bundler was run" do
71
69
  Bundler.with_original_env do
72
- `echo $BUNDLE_PATH`.strip.should == './Gemfile'
70
+ expect(`echo $BUNDLE_PATH`.strip).to eq('./Gemfile')
73
71
  end
74
72
  end
75
73
  end
@@ -77,7 +75,7 @@ describe "Bundler.with_env helpers" do
77
75
  describe "Bundler.clean_system" do
78
76
  it "runs system inside with_clean_env" do
79
77
  Bundler.clean_system(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh})
80
- $?.exitstatus.should == 42
78
+ expect($?.exitstatus).to eq(42)
81
79
  end
82
80
  end
83
81
 
@@ -87,7 +85,7 @@ describe "Bundler.with_env helpers" do
87
85
  Bundler.clean_exec(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh})
88
86
  end
89
87
  Process.wait(pid)
90
- $?.exitstatus.should == 42
88
+ expect($?.exitstatus).to eq(42)
91
89
  end
92
90
  end
93
91