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