Sha256: f508e0634c8c7c5f293f10157ac91a51cd097794ce7ad2d2221efbb104bb79f3
Contents?: true
Size: 1.68 KB
Versions: 2
Compression:
Stored size: 1.68 KB
Contents
module JsonVoorhees class AppMakeTestsGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) argument :module_name, :type => :string argument :resource_name, :type => :string argument :api_version, :type => :string, :default => "1" class_option :model, :type => :boolean, :default => true, :description => "Create model stub tests" class_option :request, :type => :boolean, :default => true, :description => "Create request stub tests" class_option :routing, :type => :boolean, :default => true, :description => "Create routing stub tests" class_option :arcadex, :type => :boolean, :default => true, :description => "Send requests with an arcadex header" def sprint if options.model? template "model.rb.erb", "spec/engines/#{module_name.underscore}/api/v#{api_version}/models/#{resource_singular}_spec.rb" end if options.request? if options.arcadex? template "request.rb.erb", "spec/engines/#{module_name.underscore}/api/v#{api_version}/requests/#{resource_singular}_spec.rb" else end end if options.routing? template "routing.rb.erb", "spec/engines/#{module_name.underscore}/api/v#{api_version}/routing/#{resource_singular}_spec.rb" end template "factory.rb.erb", "spec/factories/#{module_name.underscore}_#{resource_singular}_factory.rb" end private def resource_singular resource_name.underscore.singularize end def resource_plural resource_name.underscore.pluralize end def resource_camel resource_name.camelize.singularize end def module_camel module_name.camelize end def module_snake module_name.underscore.downcase end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
json_voorhees-0.0.2 | lib/generators/json_voorhees/app_make_tests/app_make_tests_generator.rb |
json_voorhees-0.0.1 | lib/generators/json_voorhees/app_make_tests/app_make_tests_generator.rb |