Sha256: 7a27142e3f2860e4b8986d9802c282dab3f6b83cc01a24a5976ae6fca384c455
Contents?: true
Size: 993 Bytes
Versions: 11
Compression:
Stored size: 993 Bytes
Contents
require 'generators/rspec' require 'rails/generators/resource_helpers' module Rspec module Generators class ScaffoldGenerator < Base include ::Rails::Generators::ResourceHelpers source_paths.unshift File::expand_path('../templates/rspec/scaffold', __FILE__) class_option :with_api, type: :boolean, desc: "Generates also API controller in 'app/contorllers/api'" class_option :api_version, type: :string, desc: "Adds specified path as version to 'app/contorllers/api'" def generate_api_controller_spec return unless options[:controller_specs] return unless options[:with_api] path = [ 'spec/controllers/api', options[:api_version], controller_class_path, "#{controller_file_name}_controller_spec.rb" ].compact template_file = File.join *path template 'api_controller_spec.rb', template_file end end end end
Version data entries
11 entries across 11 versions & 1 rubygems