1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add missing inflector dependency

This commit is contained in:
Mike Moore 2012-09-25 15:40:00 -06:00
parent 64f254ccf7
commit b13400086c
2 changed files with 3 additions and 4 deletions

View file

@ -1,4 +1,5 @@
require "active_support/concern"
require "active_support/inflector"
module ActiveSupport
module Testing
@ -33,9 +34,7 @@ module ActiveSupport
def determine_constant_from_test_name(test_name)
names = test_name.split "::"
while names.size > 0 do
names.last.sub! /Test$/, ""
# Rails 3.0 doesn't have safe_constantize,
# so we'll do it the hard way.
names.last.sub!(/Test$/, "")
begin
constant = names.join("::").constantize
break(constant) if yield(constant)

View file

@ -8,7 +8,7 @@ end
class Baz < Bar; end
module FooBar; end
class TestLookup < ActiveSupport::TestCase
class ConstantLookupTest < ActiveSupport::TestCase
def find_foo(name)
self.class.determine_constant_from_test_name(name) do |constant|