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

ruby-changes:21735

From: usa <ko1@a...>
Date: Fri, 18 Nov 2011 13:21:35 +0900 (JST)
Subject: [ruby-changes:21735] usa:r33784 (trunk): * test/unit/assertions.rb (MINI_DIR): quick dirty hack to get rid of

usa	2011-11-18 13:21:23 +0900 (Fri, 18 Nov 2011)

  New Revision: 33784

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

  Log:
    * test/unit/assertions.rb (MINI_DIR): quick dirty hack to get rid of
      warnings when using assert/assert_respond_to.

  Modified files:
    trunk/ChangeLog
    trunk/lib/test/unit/assertions.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33783)
+++ ChangeLog	(revision 33784)
@@ -1,3 +1,8 @@
+Fri Nov 18 13:20:26 2011  NAKAMURA Usaku  <usa@r...>
+
+	* test/unit/assertions.rb (MINI_DIR): quick dirty hack to get rid of
+	  warnings when using assert/assert_respond_to.
+
 Fri Nov 18 13:03:38 2011  NAKAMURA Usaku  <usa@r...>
 
 	* io.c (rb_cloexec_open): set O_NOINHERIT instead of O_CLOEXEC if it is
Index: lib/test/unit/assertions.rb
===================================================================
--- lib/test/unit/assertions.rb	(revision 33783)
+++ lib/test/unit/assertions.rb	(revision 33784)
@@ -10,6 +10,8 @@
         obj.pretty_inspect.chomp
       end
 
+      MINI_DIR = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), "minitest") #:nodoc:
+
       UNASSIGNED = Object.new # :nodoc:
 
       # :call-seq:
@@ -30,7 +32,7 @@
           msg = nil
         when String, Proc
         else
-          bt = caller.reject { |s| s.rindex(MiniTest::MINI_DIR, 0) }
+          bt = caller.reject { |s| s.rindex(MINI_DIR, 0) }
           raise ArgumentError, "assertion message must be String or Proc, but #{msg.class} was given.", bt
         end
         super
@@ -250,7 +252,7 @@
       #    assert_respond_to("hello", :does_not_exist)  #Fails
       def assert_respond_to obj, meth, msg = nil
         #get rid of overcounting
-        super if !caller[0].rindex(MiniTest::MINI_DIR, 0) || !obj.respond_to?(meth)
+        super if !caller[0].rindex(MINI_DIR, 0) || !obj.respond_to?(meth)
       end
 
       # :call-seq:

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

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