be able to have multiple extensions counted as 'javascript'

This commit is contained in:
John Bintz 2011-05-02 17:53:57 -04:00
parent bfae720599
commit 77fbea1b18

View File

@ -1,6 +1,8 @@
module JasmineMixin module JasmineMixin
JASMINE_PROGRAM = File.expand_path('../../../bin/jasmine-headless-webkit', __FILE__) JASMINE_PROGRAM = File.expand_path('../../../bin/jasmine-headless-webkit', __FILE__)
JAVASCRIPT_EXTENSIONS = %w{js}
def self.included(klass) def self.included(klass)
klass::ALL_HOOKS << [ :run_jasmine, :ran_jasmine ] klass::ALL_HOOKS << [ :run_jasmine, :ran_jasmine ]
end end
@ -57,13 +59,15 @@ module JasmineMixin
def find_files def find_files
Hash[super.find_all { |file, mtime| Hash[super.find_all { |file, mtime|
is_js = (file[%r{\.(#{JAVASCRIPT_EXTENSIONS.join('|')})$}] != nil)
case self.is_jasmine_running case self.is_jasmine_running
when :all when :all
true true
when :no when :no
file[%r{\.js$}] == nil !is_js
when :yes when :yes
file[%r{\.js$}] != nil is_js
end end
}] }]
end end
@ -81,4 +85,8 @@ module JasmineMixin
[ "spec/javascripts/#{m[1]}_spec.js" ] [ "spec/javascripts/#{m[1]}_spec.js" ]
} }
end end
def add_javascript_extensions(*extensions)
self.class::JAVASCRIPT_EXTENSIONS << extensions
end
end end