Sha256: 71820536f5aa915eadf0b1588f4481682c5a7c3b96a173c20389b08f8849447d
Contents?: true
Size: 1012 Bytes
Versions: 2
Compression:
Stored size: 1012 Bytes
Contents
require 'rails_generator' require 'shenandoah/rails/locator' module Shenandoah module Generators class ShenSpecGenerator < ::Rails::Generator::NamedBase def manifest record do |m| m.directory "#{spec_path}/#{File.dirname(file_path)}" m.template 'javascript_spec.js.erb', "#{spec_path}/#{file_path}_spec.js" m.template 'fixture.html.erb', "#{spec_path}/#{file_path}.html" end end def spec_path ENV['SHEN_SPEC_PATH'] || Shenandoah::Rails::Locator.new.spec_path.sub(%r{^#{RAILS_ROOT}/}, '') end def file_path super.sub /_spec$/, '' end def javascript_class_name klass, *mods_rev = class_name.sub(/Spec$/, '').split('::').reverse mod_spec = mods_rev.reverse.collect { |m| m.downcase }.join('.') [mod_spec, klass].reject { |p| p == "" }.join '.' end def spec_helper? File.exist?("#{destination_root}/#{spec_path}/spec_helper.js") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shenandoah-0.2.0 | rails_generators/shen_spec/shen_spec_generator.rb |
shenandoah-0.1.3 | rails_generators/shen_spec/shen_spec_generator.rb |