aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorAbdelkader Boudih <terminale@gmail.com>2014-08-22 19:30:36 +0000
committerAbdelkader Boudih <terminale@gmail.com>2014-08-22 20:06:22 +0000
commite63a02ccfbbdc0aeefd57617c835a2adc8588dd3 (patch)
tree3b1c8d6b0847f2abb952ff1411f12d3cd2633f5a /railties
parentb47d8dea25aa4c1b0d02603adc00cf63f2163f21 (diff)
downloadrails-e63a02ccfbbdc0aeefd57617c835a2adc8588dd3.tar.gz
rails-e63a02ccfbbdc0aeefd57617c835a2adc8588dd3.tar.bz2
rails-e63a02ccfbbdc0aeefd57617c835a2adc8588dd3.zip
[ActiveJob] Add hook for test_framework and test templates
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/test_unit/job/job_generator.rb13
-rw-r--r--railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb9
2 files changed, 22 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/test_unit/job/job_generator.rb b/railties/lib/rails/generators/test_unit/job/job_generator.rb
new file mode 100644
index 0000000000..05d9fde280
--- /dev/null
+++ b/railties/lib/rails/generators/test_unit/job/job_generator.rb
@@ -0,0 +1,13 @@
+require 'rails/generators/test_unit'
+
+module TestUnit # :nodoc:
+ module Generators # :nodoc:
+ class JobGenerator < Base # :nodoc:
+ check_class_collision suffix: 'JobTest'
+
+ def create_test_file
+ template 'unit_test.rb.erb', File.join('test/job', class_path, "#{file_name}_test.rb")
+ end
+ end
+ end
+end
diff --git a/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb b/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb
new file mode 100644
index 0000000000..6200218313
--- /dev/null
+++ b/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb
@@ -0,0 +1,9 @@
+require 'test_helper'
+
+<% module_namespacing do -%>
+class <%= class_name %>JobTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
+<% end -%>