Skip to content

Commit 98b886b

Browse files
committed
Offer option to suppress generation of request spec
- also renamed a bunch of generator methods to make them all more consistent - Closes #237.
1 parent 953eefc commit 98b886b

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

lib/generators/rspec/controller/controller_generator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ class ControllerGenerator < Base
99
class_option :controller_specs, :type => :boolean, :default => true
1010
class_option :view_specs, :type => :boolean, :default => true
1111

12-
def create_controller_files
12+
def generate_controller_spec
1313
return unless options[:controller_specs]
1414

1515
template 'controller_spec.rb',
1616
File.join('spec/controllers', class_path, "#{file_name}_controller_spec.rb")
1717
end
1818

19-
def create_view_files
19+
def generate_view_specs
2020
return if actions.empty?
2121
return unless options[:view_specs]
2222

lib/generators/rspec/helper/helper_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Generators
55
class HelperGenerator < Base
66
class_option :helper_specs, :type => :boolean, :default => true
77

8-
def create_helper_files
8+
def generate_helper_spec
99
return unless options[:helper_specs]
1010

1111
template 'helper_spec.rb', File.join('spec/helpers', class_path, "#{file_name}_helper_spec.rb")

lib/generators/rspec/integration/integration_generator.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
module Rspec
44
module Generators
55
class IntegrationGenerator < Base
6-
def create_integration_file
6+
class_option :request_specs, :type => :boolean, :default => true, :desc => "Generate request specs"
7+
8+
def generate_request_spec
9+
return unless options[:request_specs]
10+
711
template 'request_spec.rb',
812
File.join('spec/requests', class_path, "#{table_name}_spec.rb")
913
end

lib/generators/rspec/mailer/mailer_generator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ module Generators
55
class MailerGenerator < Base
66
argument :actions, :type => :array, :default => [], :banner => "method method"
77

8-
def create_spec_files
8+
def generate_mailer_spec
99
template "mailer_spec.rb", File.join('spec/mailers', class_path, "#{file_name}_spec.rb")
1010
end
1111

12-
def create_fixtures_files
12+
def generate_fixtures_files
1313
actions.each do |action|
1414
@action, @path = action, File.join(file_path, action)
1515
template "fixture", File.join("spec/fixtures", @path)

lib/generators/rspec/model/model_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class ModelGenerator < Base
66
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
77
class_option :fixture, :type => :boolean
88

9-
def create_test_file
9+
def create_model_spec
1010
template 'model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
1111
end
1212

lib/generators/rspec/observer/observer_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Rspec
44
module Generators
55
class ObserverGenerator < Base
6-
def create_observer_files
6+
def generate_observer_spec
77
template 'observer_spec.rb',
88
File.join('spec', 'models', class_path, "#{file_name}_observer_spec.rb")
99
end

lib/generators/rspec/scaffold/scaffold_generator.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ class ScaffoldGenerator < Base
1818
class_option :helper_specs, :type => :boolean, :default => true, :desc => "Generate helper specs"
1919
class_option :routing_specs, :type => :boolean, :default => true, :desc => "Generate routing specs"
2020

21-
def copy_controller_files
21+
def generate_controller_spec
2222
return unless options[:controller_specs]
2323

2424
template 'controller_spec.rb',
2525
File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb")
2626
end
2727

28-
def copy_view_files
28+
def generate_view_specs
2929
return unless options[:view_specs]
3030

3131
copy_view :edit
@@ -39,7 +39,7 @@ def copy_view_files
3939
invoke invoked, [ controller_name ]
4040
end
4141

42-
def copy_routing_files
42+
def generate_routing_spec
4343
return unless options[:routing_specs]
4444

4545
template 'routing_spec.rb',

lib/generators/rspec/view/view_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class ViewGenerator < Base
77

88
class_option :template_engine, :desc => "Template engine to generate view files"
99

10-
def create_view_files
10+
def create_view_specs
1111
empty_directory File.join("spec", "views", file_path)
1212

1313
actions.each do |action|

0 commit comments

Comments
 (0)