Automatically roll up any js files in spec/helpers and add them as spec_helpers

This commit is contained in:
ragaskar 2009-10-31 22:35:35 -07:00
parent fcc1872d48
commit 7c043eb5d0
5 changed files with 16 additions and 5 deletions

View File

@ -14,7 +14,8 @@ if ARGV[0] == 'server'
puts " http://localhost:8888/run.html" puts " http://localhost:8888/run.html"
Jasmine::SimpleServer.start(8888, Jasmine::SimpleServer.start(8888,
lambda { JasmineHelper.specs }, lambda { JasmineHelper.specs },
JasmineHelper.dir_mappings) JasmineHelper.dir_mappings,
:spec_helpers => JasmineHelper.spec_helpers)
end end
if ARGV[0] == 'init' if ARGV[0] == 'init'

@ -1 +1 @@
Subproject commit f9d73761bb0eaf5a38d522c7d5b0557efc693cd1 Subproject commit 8feb285ca839cb383eb433c5660ab0f98e86704b

View File

@ -37,6 +37,14 @@ class JasmineHelper
spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")} spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
end end
def self.spec_helpers_files
Dir.glob(File.join(jasmine_spec_dir, "helpers/**/*.js"))
end
def self.spec_helpers
spec_helpers_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
end
def self.dir_mappings def self.dir_mappings
{ {
"/spec" => jasmine_spec_dir, "/spec" => jasmine_spec_dir,

View File

@ -8,7 +8,8 @@ require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jas
jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path, jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path,
JasmineHelper.spec_file_urls, JasmineHelper.spec_file_urls,
JasmineHelper.dir_mappings) JasmineHelper.dir_mappings,
:spec_helpers => JasmineHelper.spec_helpers)
spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner) spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner)

View File

@ -8,7 +8,8 @@ def start_jasmine_server
Jasmine::SimpleServer.start(8888, Jasmine::SimpleServer.start(8888,
lambda { JasmineHelper.spec_file_urls }, lambda { JasmineHelper.spec_file_urls },
JasmineHelper.dir_mappings) JasmineHelper.dir_mappings,
:spec_helpers => lambda { JasmineHelper.spec_helpers })
end end
namespace :jasmine do namespace :jasmine do