Class: MiniTest::Generators::Base
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- MiniTest::Generators::Base
- Defined in:
- lib/generators/mini_test.rb
Overview
:nodoc:
Direct Known Subclasses
ControllerGenerator, HelperGenerator, IntegrationGenerator, MailerGenerator, ModelGenerator, ScaffoldGenerator
Class Method Summary collapse
Instance Method Summary collapse
- #attributes_names ⇒ Object
- #key_value(key, value) ⇒ Object
-
#module_namespacing(&block) ⇒ Object
Fill in methods that might be missing depending on the version of Rails.
Class Method Details
.default_source_root ⇒ Object
13 14 15 |
# File 'lib/generators/mini_test.rb', line 13 def self.default_source_root File.(File.join(File.dirname(__FILE__), 'mini_test', generator_name, 'templates')) end |
Instance Method Details
#attributes_names ⇒ Object
33 34 35 36 37 38 |
# File 'lib/generators/mini_test.rb', line 33 def attributes_names @attributes_names ||= attributes.each_with_object([]) do |a, names| names << a.column_name names << "#{a.name}_type" if a.polymorphic? end end |
#key_value(key, value) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/generators/mini_test.rb', line 25 def key_value(key, value) if [:old_style_hash] || RUBY_VERSION < '1.9' ":#{key} => #{value}" else "#{key}: #{value}" end end |
#module_namespacing(&block) ⇒ Object
Fill in methods that might be missing depending on the version of Rails
21 22 23 |
# File 'lib/generators/mini_test.rb', line 21 def module_namespacing(&block) yield if block_given? end |