diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-10-20 21:21:14 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-11-02 17:14:50 +0100 |
commit | b36fa51a3f56431d8e46c1fff6a6493d3c10607a (patch) | |
tree | a446299bd74918c0942b64a38b5f74404eccb94d /railties/test | |
parent | fd1562af8c662fee8a44d244eaed3350ce10e7da (diff) | |
download | rails-b36fa51a3f56431d8e46c1fff6a6493d3c10607a.tar.gz rails-b36fa51a3f56431d8e46c1fff6a6493d3c10607a.tar.bz2 rails-b36fa51a3f56431d8e46c1fff6a6493d3c10607a.zip |
Allow easy overriding of test framework in 'rake plugin new' generator, using PluginBuilder
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/fixtures/lib/plugin_builders/spec_builder.rb | 13 | ||||
-rw-r--r-- | railties/test/generators/plugin_new_generator_test.rb | 10 |
2 files changed, 23 insertions, 0 deletions
diff --git a/railties/test/fixtures/lib/plugin_builders/spec_builder.rb b/railties/test/fixtures/lib/plugin_builders/spec_builder.rb new file mode 100644 index 0000000000..bdaa1fb8e1 --- /dev/null +++ b/railties/test/fixtures/lib/plugin_builders/spec_builder.rb @@ -0,0 +1,13 @@ +class PluginBuilder < Rails::PluginBuilder + def test + create_file "spec/spec_helper.rb" + end + + def test_path + "spec" + end + + def rakefile_test_tasks + "# spec tasks in rakefile" + end +end diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb index 0d88d36971..a7177914e1 100644 --- a/railties/test/generators/plugin_new_generator_test.rb +++ b/railties/test/generators/plugin_new_generator_test.rb @@ -217,6 +217,16 @@ class CustomPluginGeneratorTest < Rails::Generators::TestCase DEFAULT_PLUGIN_FILES.each{ |path| assert_no_file path } end + def test_overriding_test_framework + FileUtils.cd(destination_root) + run_generator([destination_root, "-b", "#{Rails.root}/lib/plugin_builders/spec_builder.rb"]) + assert_file 'spec/spec_helper.rb' + assert_file 'Rakefile', /task :default => :spec/ + assert_file 'Rakefile', /# spec tasks in rakefile/ + assert_file 'spec/dummy' + assert_file 'script/rails', %r{spec/dummy} + end + protected def action(*args, &block) |