Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Offer option to suppress generation of request spec

- also renamed a bunch of generator methods to make them all more
  consistent
- Closes #237.
  • Loading branch information...
commit 98b886b5528aa2a60c42d80b83a0973f24bfcdb7 1 parent 953eefc
@dchelimsky dchelimsky authored
View
4 lib/generators/rspec/controller/controller_generator.rb
@@ -9,14 +9,14 @@ class ControllerGenerator < Base
class_option :controller_specs, :type => :boolean, :default => true
class_option :view_specs, :type => :boolean, :default => true
- def create_controller_files
+ def generate_controller_spec
return unless options[:controller_specs]
template 'controller_spec.rb',
File.join('spec/controllers', class_path, "#{file_name}_controller_spec.rb")
end
- def create_view_files
+ def generate_view_specs
return if actions.empty?
return unless options[:view_specs]
View
2  lib/generators/rspec/helper/helper_generator.rb
@@ -5,7 +5,7 @@ module Generators
class HelperGenerator < Base
class_option :helper_specs, :type => :boolean, :default => true
- def create_helper_files
+ def generate_helper_spec
return unless options[:helper_specs]
template 'helper_spec.rb', File.join('spec/helpers', class_path, "#{file_name}_helper_spec.rb")
View
6 lib/generators/rspec/integration/integration_generator.rb
@@ -3,7 +3,11 @@
module Rspec
module Generators
class IntegrationGenerator < Base
- def create_integration_file
+ class_option :request_specs, :type => :boolean, :default => true, :desc => "Generate request specs"
+
+ def generate_request_spec
+ return unless options[:request_specs]
+
template 'request_spec.rb',
File.join('spec/requests', class_path, "#{table_name}_spec.rb")
end
View
4 lib/generators/rspec/mailer/mailer_generator.rb
@@ -5,11 +5,11 @@ module Generators
class MailerGenerator < Base
argument :actions, :type => :array, :default => [], :banner => "method method"
- def create_spec_files
+ def generate_mailer_spec
template "mailer_spec.rb", File.join('spec/mailers', class_path, "#{file_name}_spec.rb")
end
- def create_fixtures_files
+ def generate_fixtures_files
actions.each do |action|
@action, @path = action, File.join(file_path, action)
template "fixture", File.join("spec/fixtures", @path)
View
2  lib/generators/rspec/model/model_generator.rb
@@ -6,7 +6,7 @@ class ModelGenerator < Base
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
class_option :fixture, :type => :boolean
- def create_test_file
+ def create_model_spec
template 'model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
end
View
2  lib/generators/rspec/observer/observer_generator.rb
@@ -3,7 +3,7 @@
module Rspec
module Generators
class ObserverGenerator < Base
- def create_observer_files
+ def generate_observer_spec
template 'observer_spec.rb',
File.join('spec', 'models', class_path, "#{file_name}_observer_spec.rb")
end
View
6 lib/generators/rspec/scaffold/scaffold_generator.rb
@@ -18,14 +18,14 @@ class ScaffoldGenerator < Base
class_option :helper_specs, :type => :boolean, :default => true, :desc => "Generate helper specs"
class_option :routing_specs, :type => :boolean, :default => true, :desc => "Generate routing specs"
- def copy_controller_files
+ def generate_controller_spec
return unless options[:controller_specs]
template 'controller_spec.rb',
File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb")
end
- def copy_view_files
+ def generate_view_specs
return unless options[:view_specs]
copy_view :edit
@@ -39,7 +39,7 @@ def copy_view_files
invoke invoked, [ controller_name ]
end
- def copy_routing_files
+ def generate_routing_spec
return unless options[:routing_specs]
template 'routing_spec.rb',
View
2  lib/generators/rspec/view/view_generator.rb
@@ -7,7 +7,7 @@ class ViewGenerator < Base
class_option :template_engine, :desc => "Template engine to generate view files"
- def create_view_files
+ def create_view_specs
empty_directory File.join("spec", "views", file_path)
actions.each do |action|
Please sign in to comment.
Something went wrong with that request. Please try again.