be able to have multiple extensions counted as 'javascript'
This commit is contained in:
parent
bfae720599
commit
77fbea1b18
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user