Make config.generators accept string namespaces, you can do now config.generators.test_framework 'rspec' for instance

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Santiago Pastorino 2010-07-21 11:37:03 -03:00 committed by José Valim
parent 79d6f314c6
commit e107c208f0
2 changed files with 16 additions and 0 deletions

@ -60,6 +60,7 @@ def method_missing(method, *args)
namespace, configuration = method, args.shift
else
namespace, configuration = args.shift, args.shift
namespace = namespace.to_sym if namespace.respond_to?(:to_sym)
@options[:rails][method] = namespace
end

@ -103,5 +103,20 @@ def with_bare_config
assert_equal({ :plugin => { :generator => "-g" } }, c.generators.aliases)
end
end
test "generators with string and hash for options should generate symbol keys" do
with_bare_config do |c|
c.generators do |g|
g.orm 'datamapper', :migration => false
end
expected = {
:rails => { :orm => :datamapper },
:datamapper => { :migration => false }
}
assert_equal expected, c.generators.options
end
end
end
end