diff options
Diffstat (limited to 'railties/lib/generators/test_unit/model/model_generator.rb')
-rw-r--r-- | railties/lib/generators/test_unit/model/model_generator.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/railties/lib/generators/test_unit/model/model_generator.rb b/railties/lib/generators/test_unit/model/model_generator.rb index 901ed70468..6aff027107 100644 --- a/railties/lib/generators/test_unit/model/model_generator.rb +++ b/railties/lib/generators/test_unit/model/model_generator.rb @@ -4,18 +4,16 @@ module TestUnit argument :attributes, :type => :hash, :default => {}, :banner => "field:type, field:type" check_class_collision :suffix => "Test" - - # TODO Add DEFAULTS support - class_option :skip_fixture, :type => :boolean, :default => false, - :desc => "Don't generate a fixture file" + conditional_class_option :fixture def create_test_file template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb") end - # TODO Add fixture replacement support + invoke_for :fixture_replacement + def create_fixture_file - unless options[:skip_fixture] + if options[:fixture] && options[:fixture_replacement].nil? template 'fixtures.yml', File.join('test/fixtures', "#{table_name}.yml") end end |