Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed generator

  • Loading branch information...
commit b22d0f3c287f2d9f92ba089894774390a0eee425 1 parent 7d149bb
@dcrec1 dcrec1 authored
View
21 lib/generators/blue_ridge/javascript_spec/javascript_spec_generator.rb
@@ -10,12 +10,8 @@ def execute
empty_directory "#{base_dir}/fixtures"
options = {:class_name_without_spec => class_name_without_spec, :file_path_without_spec => file_path_without_spec}
- file_path_with_spec.each do |name|
- template 'javascript_spec.js.erb', "#{base_dir}/#{name}.js", :assigns => options
- end
- file_path_without_spec.each do |name|
- template 'fixture.html.erb', "#{base_dir}/fixtures/#{name}.html", :assigns => options
- end
+ template 'javascript_spec.js.erb', "#{base_dir}/#{file_path_with_spec}.js", :assigns => options
+ template 'fixture.html.erb', "#{base_dir}/fixtures/#{file_path_without_spec}.html", :assigns => options
end
def self.gem_root
@@ -26,7 +22,6 @@ def self.source_root
File.join(gem_root, 'templates', 'javascript_spec')
end
-
protected
def file_path_with_and_without_spec
if (file_path =~ /_spec$/i)
@@ -35,12 +30,18 @@ def file_path_with_and_without_spec
[file_path + "_spec", file_path]
end
end
- alias_method :file_path_without_spec, :file_path_with_and_without_spec
- alias_method :file_path_with_spec, :file_path_with_and_without_spec
+
+ def file_path_without_spec
+ file_path_with_and_without_spec.last
+ end
+
+ def file_path_with_spec
+ file_path_with_and_without_spec.first
+ end
def class_name_without_spec
(class_name =~ /Spec$/) ? class_name.gsub(/Spec$/, "") : class_name
end
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.