[前][次][番号順一覧][スレッド一覧]

ruby-changes:27556

From: drbrain <ko1@a...>
Date: Wed, 6 Mar 2013 08:11:52 +0900 (JST)
Subject: [ruby-changes:27556] drbrain:r39608 (trunk): * test/rubygems/test_require.rb: Fix tests when 'a.rb' exists.

drbrain	2013-03-06 08:11:43 +0900 (Wed, 06 Mar 2013)

  New Revision: 39608

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39608

  Log:
    * test/rubygems/test_require.rb:  Fix tests when 'a.rb' exists.
      [ruby-trunk - Bug #7749]

  Modified files:
    trunk/ChangeLog
    trunk/test/rubygems/test_require.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39607)
+++ ChangeLog	(revision 39608)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Mar  6 08:10:15 2013  Eric Hodel  <drbrain@s...>
+
+	* test/rubygems/test_require.rb:  Fix tests when 'a.rb' exists.
+	  [ruby-trunk - Bug #7749]
+
 Wed Mar  6 08:00:59 2013  Eric Hodel  <drbrain@s...>
 
 	* lib/rubygems.rb:  Allow specification of directory permissions.
Index: test/rubygems/test_require.rb
===================================================================
--- test/rubygems/test_require.rb	(revision 39607)
+++ test/rubygems/test_require.rb	(revision 39608)
@@ -2,19 +2,30 @@ require 'rubygems/test_case' https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L2
 require 'rubygems'
 
 class TestGemRequire < Gem::TestCase
+
+  def setup
+    super
+
+    assert_raises LoadError do
+      save_loaded_features do
+        require 'test_gem_require_a'
+      end
+    end
+  end
+
   def assert_require(path)
     assert require(path), "'#{path}' was already required"
   end
 
   def test_require_is_not_lazy_with_exact_req
-    a1 = new_spec "a", "1", {"b" => "= 1"}, "lib/a.rb"
+    a1 = new_spec "a", "1", {"b" => "= 1"}, "lib/test_gem_require_a.rb"
     b1 = new_spec "b", "1", nil, "lib/b/c.rb"
     b2 = new_spec "b", "2", nil, "lib/b/c.rb"
 
     install_specs a1, b1, b2
 
     save_loaded_features do
-      assert_require 'a'
+      assert_require 'test_gem_require_a'
       assert_equal %w(a-1 b-1), loaded_spec_names
       assert_equal unresolved_names, []
 
@@ -24,14 +35,14 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L35
   end
 
   def test_require_is_lazy_with_inexact_req
-    a1 = new_spec "a", "1", {"b" => ">= 1"}, "lib/a.rb"
+    a1 = new_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
     b1 = new_spec "b", "1", nil, "lib/b/c.rb"
     b2 = new_spec "b", "2", nil, "lib/b/c.rb"
 
     install_specs a1, b1, b2
 
     save_loaded_features do
-      assert_require 'a'
+      assert_require 'test_gem_require_a'
       assert_equal %w(a-1), loaded_spec_names
       assert_equal unresolved_names, ["b (>= 1)"]
 
@@ -41,13 +52,13 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L52
   end
 
   def test_require_is_not_lazy_with_one_possible
-    a1 = new_spec "a", "1", {"b" => ">= 1"}, "lib/a.rb"
+    a1 = new_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
     b1 = new_spec "b", "1", nil, "lib/b/c.rb"
 
     install_specs a1, b1
 
     save_loaded_features do
-      assert_require 'a'
+      assert_require 'test_gem_require_a'
       assert_equal %w(a-1 b-1), loaded_spec_names
       assert_equal unresolved_names, []
 
@@ -59,13 +70,13 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L70
   def test_activate_via_require_respects_loaded_files
     require 'benchmark' # stdlib
     save_loaded_features do
-      a1 = new_spec "a", "1", {"b" => ">= 1"}, "lib/a.rb"
+      a1 = new_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
       b1 = new_spec "b", "1", nil, "lib/benchmark.rb"
       b2 = new_spec "b", "2", nil, "lib/benchmark.rb"
 
       install_specs a1, b1, b2
 
-      require 'a'
+      require 'test_gem_require_a'
       assert_equal unresolved_names, ["b (>= 1)"]
 
       refute require('benchmark'), "benchmark should have already been loaded"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]