fix a bug and give a message when the cache is building

This commit is contained in:
John Bintz 2011-09-02 11:31:58 -04:00
parent 8b8fc32f80
commit b21573b1dc
2 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,6 @@
require 'jasmine-core'
require 'iconv'
require 'time'
module Jasmine
class FilesList
@ -11,6 +12,8 @@ module Jasmine
File.expand_path('../../../jasmine/jasmine.headless-reporter.js', __FILE__)
]
PLEASE_WAIT_IM_WORKING_TIME = 2
def initialize(options = {})
@options = options
@files = DEFAULT_FILES.dup
@ -50,7 +53,14 @@ module Jasmine
private
def to_html(files)
alert_time = Time.now + PLEASE_WAIT_IM_WORKING_TIME
files.collect { |file|
if alert_time && alert_time < Time.now
puts "Rebuilding cache, please wait..."
alert_time = nil
end
case File.extname(file)
when '.coffee'
begin
@ -67,7 +77,7 @@ module Jasmine
when '.css'
%{<link rel="stylesheet" href="#{file}" type="text/css" />}
end
}.flatten.reject(&:empty?)
}.flatten.compact.reject(&:empty?)
end
def spec_filter

View File

@ -151,6 +151,7 @@ describe Jasmine::FilesList do
files_list.instance_variable_set(:@files, [
'test.js',
'test.coffee',
'test.whatever',
'test.css'
])