From 5337766fa02142c72312ae2d39620e377f6c7155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 25 Jun 2009 10:21:00 +0200 Subject: [PATCH] Tests for metal generator. --- .../test/generators/metal_generator_test.rb | 18 ++++++++++++++++++ .../test/generators/plugin_generator_test.rb | 4 ---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 railties/test/generators/metal_generator_test.rb diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb new file mode 100644 index 0000000000..dfa948d14e --- /dev/null +++ b/railties/test/generators/metal_generator_test.rb @@ -0,0 +1,18 @@ +require 'abstract_unit' +require 'generators/generators_test_helper' +require 'generators/rails/metal/metal_generator' + +class MetalGeneratorTest < GeneratorsTestCase + + def test_metal_skeleton_is_created + run_generator + assert_file "app/metal/foo.rb", /class Foo/ + end + + protected + + def run_generator(args=[]) + silence(:stdout) { Rails::Generators::MetalGenerator.start ["foo"].concat(args), :root => destination_root } + end + +end diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index a28a007ff8..b4aa39ae5f 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -44,8 +44,4 @@ class PluginGeneratorTest < GeneratorsTestCase silence(:stdout) { Rails::Generators::PluginGenerator.start ["plugin_fu"].concat(args), :root => destination_root } end - def generator(options={}) - @generator ||= Rails::Generators::PluginGenerator.new(["plugin_fu"], options, :root => destination_root) - end - end