Better argument handling in Jasmine::Core#spec_files

This commit is contained in:
ragaskar
2011-06-18 09:43:14 -04:00
parent 0d43ae9c38
commit e9af7834f5
3 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -9,6 +9,8 @@ module Jasmine
(["jasmine.js"] + Dir.glob(File.join(path, "*.js"))).map { |f| File.basename(f) }.uniq (["jasmine.js"] + Dir.glob(File.join(path, "*.js"))).map { |f| File.basename(f) }.uniq
end end
SPEC_TYPES = ["core", "html", "node"]
def core_spec_files def core_spec_files
spec_files("core") spec_files("core")
end end
@@ -22,7 +24,8 @@ module Jasmine
end end
def spec_files(type) def spec_files(type)
(Dir.glob(File.join(path, "spec/#{type}/*.js"))).map { |f| File.join("spec", type, File.basename(f)) }.uniq raise ArgumentError.new("Unrecognized spec type") unless SPEC_TYPES.include?(type)
(Dir.glob(File.join(path, "spec", type, "*.js"))).map { |f| File.join("spec", type, File.basename(f)) }.uniq
end end
def css_files def css_files
+1 -1
View File
@@ -2472,5 +2472,5 @@ jasmine.version_= {
"major": 1, "major": 1,
"minor": 1, "minor": 1,
"build": 0, "build": 0,
"revision": 1308358300 "revision": 1308404354
}; };
+1 -1
View File
@@ -2,5 +2,5 @@ jasmine.version_= {
"major": 1, "major": 1,
"minor": 1, "minor": 1,
"build": 0, "build": 0,
"revision": 1308358300 "revision": 1308404354
}; };