Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow generator specs to work with --default_path

  • Loading branch information...
commit 1416314deb29ba3e47a457090b863e78a4734d2a 1 parent 59a41f6
@justinko justinko authored
Showing with 6 additions and 10 deletions.
  1. +6 −10 lib/generators/rspec/scaffold/scaffold_generator.rb
View
16 lib/generators/rspec/scaffold/scaffold_generator.rb
@@ -67,20 +67,16 @@ def params
# support for namespaced-resources
def ns_file_name
- if ARGV[0].match(/(\w+)\/(\w+)/)
- "#{$1.underscore}_#{$2.singularize.underscore}"
- else
- file_name
- end
+ ns_given? ? "#{$1.underscore}_#{$2.singularize.underscore}" : file_name
end
# support for namespaced-resources
def ns_table_name
- if ARGV[0].match(/(\w+)\/(\w+)/)
- "#{$1.underscore}/#{$2.tableize}"
- else
- table_name
- end
+ ns_given? ? "#{$1.underscore}/#{$2.tableize}" : table_name
+ end
+
+ def ns_given?
+ ARGV.any? && ARGV[0].match(/(\w+)\/(\w+)/)
end
# Returns the name of the mock. For example, if the file name is user,

1 comment on commit 1416314

@dchelimsky
Owner

FYI - this change broke the generator, but in such a way that we didn't see it in CI. I fixed it in 1b1c181

Please sign in to comment.
Something went wrong with that request. Please try again.