Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

model_generator: Add support for Test::Unit

(taken from
emk@660ad9e)
  • Loading branch information...
commit e19d453de6cc9393dde67322b79c380612a5adc1 1 parent e3ba976
@jmbejar authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/generators/machinist/model/model_generator.rb
View
8 lib/generators/machinist/model/model_generator.rb
@@ -2,11 +2,17 @@ module Machinist
module Generators #:nodoc:
class ModelGenerator < Rails::Generators::NamedBase #:nodoc:
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
+ class_option :test_framework, :type => :string, :aliases => "-t", :desc => "Test framework to use Machinist with"
def create_blueprint
- append_file "spec/support/blueprints.rb", "\n#{class_name}.blueprint do\n # Attributes here\nend\n"
+ append_file blueprints_path, "\n#{class_name}.blueprint do\n # Attributes here\nend\n"
end
+ protected
+
+ def blueprints_path
+ options[:test_framework] == :rspec ? "spec/support/blueprints.rb" : "test/blueprints.rb"
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.