Ensure generator fallbacks work even when a context is given.
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
This commit is contained in:
parent
d6f10126eb
commit
d0aa0cfbd7
@ -198,7 +198,7 @@ def self.find_by_namespace(name, base=nil, context=nil) #:nodoc:
|
||||
return klass if klass
|
||||
end
|
||||
|
||||
invoke_fallbacks_for(name, base)
|
||||
invoke_fallbacks_for(name, base) || invoke_fallbacks_for(context, name)
|
||||
end
|
||||
|
||||
# Receives a namespace, arguments and the behavior to invoke the generator.
|
||||
|
@ -150,6 +150,13 @@ def test_fallbacks_for_generators_on_find_by_namespace
|
||||
assert_equal "test_unit:generators:plugin", klass.namespace
|
||||
end
|
||||
|
||||
def test_fallbacks_for_generators_on_find_by_namespace_with_context
|
||||
Rails::Generators.fallbacks[:remarkable] = :test_unit
|
||||
klass = Rails::Generators.find_by_namespace(:remarkable, :rails, :plugin)
|
||||
assert klass
|
||||
assert_equal "test_unit:generators:plugin", klass.namespace
|
||||
end
|
||||
|
||||
def test_fallbacks_for_generators_on_invoke
|
||||
Rails::Generators.fallbacks[:shoulda] = :test_unit
|
||||
TestUnit::Generators::ModelGenerator.expects(:start).with(["Account"], {})
|
||||
|
Loading…
Reference in New Issue
Block a user