Sha256: f27e979ff68aee6c4b14d58c9c8a20e6ace59d4f295ef4e69c2537ab40a59ba1
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require 'rails/generators/test_unit/scaffold/scaffold_generator' require 'generators/goma/helpers/helpers' module TestUnit module Generators module Goma class ScaffoldGenerator < ::TestUnit::Generators::ScaffoldGenerator include ::Goma::Generators::Helpers source_root File.expand_path('../templates', __FILE__) class_option :controller_type, required: true class_option :resource_name def create_test_files template "#{options[:controller_type]}_functional_test.rb", File.join("test/controllers", controller_class_path, "#{controller_file_name}_controller_test.rb") end def inject_controller_test_helpers path = File.expand_path('test/test_helper.rb', destination_root) File.open path do |f| unless f.read =~ /class\s+ActionController::TestCase/ append_to_file path do <<-RUBY.strip_heredoc class ActionController::TestCase end RUBY end end end inject_into_class('test/test_helper.rb', 'ActionController::TestCase', " include Goma::ControllerTestHelpers\n") end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
goma-0.0.1.rc3 | lib/generators/test_unit/goma/scaffold/scaffold_generator.rb |