Skip to content

Commit f53ee46

Browse files
author
Sam Phippen
committed
Fix scaffold generator
1 parent 2e4420d commit f53ee46

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/generators/rspec/scaffold/scaffold_generator.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ class ScaffoldGenerator < Base
1919
class_option :helper_specs, :type => :boolean, :default => true, :desc => "Generate helper specs"
2020
class_option :routing_specs, :type => :boolean, :default => true, :desc => "Generate routing specs"
2121

22+
def initialize(*args, &blk)
23+
@generator_args = args.first
24+
super(*args, &blk)
25+
end
26+
2227
def generate_controller_spec
2328
return unless options[:controller_specs]
2429

@@ -59,6 +64,8 @@ def generate_routing_spec
5964

6065
protected
6166

67+
attr_reader :generator_args
68+
6269
def copy_view(view)
6370
template "#{view}_spec.rb",
6471
File.join("spec/views", controller_file_path, "#{view}.html.#{options[:template_engine]}_spec.rb")
@@ -76,7 +83,7 @@ def ns_table_name
7683

7784
def ns_parts
7885
@ns_parts ||= begin
79-
matches = ARGV[0].to_s.match(/\A(\w+)(?:\/|::)(\w+)/)
86+
matches = generator_args[0].to_s.match(/\A(\w+)(?:\/|::)(\w+)/)
8087
matches ? [matches[1], matches[2]] : []
8188
end
8289
end

0 commit comments

Comments
 (0)