Skip to content

Commit

Permalink
Allow generator specs to work with --default_path
Browse files Browse the repository at this point in the history
  • Loading branch information
justinko committed Oct 25, 2011
1 parent 59a41f6 commit 1416314
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/generators/rspec/scaffold/scaffold_generator.rb
Expand Up @@ -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,
Expand Down

0 comments on commit 1416314

Please sign in to comment.