a few more tweaks for things

This commit is contained in:
John Bintz 2012-03-19 11:11:29 -04:00
parent be5c7f25cd
commit 2be2edb910
7 changed files with 34 additions and 5 deletions

View File

@ -21,7 +21,7 @@ module Flowerbox
require 'flowerbox/rails/engine'
end
CACHE_DIR = '.tmp-sprockets'
CACHE_DIR = 'tmp/sprockets'
class << self
attr_writer :reporters
@ -115,6 +115,10 @@ module Flowerbox
break if env.transplant(dir)
end
end
def cache_dir
File.join(CACHE_DIR, Flowerbox.test_environment.name)
end
end
end

View File

@ -20,7 +20,7 @@ module Flowerbox::Reporter
puts result.name.join(" - ").foreground(:red)
result.failures.each do |failure|
puts " " + failure.message.foreground(:red) + " [" + failure.runners.join(',') + "] " + path_for(failure)
puts failure.stack.join("\n").foreground(:red) if failure.exception?
puts failure.filtered_stack.join("\n").foreground(:red) if failure.exception?
end
end

View File

@ -12,6 +12,8 @@ module Flowerbox::Reporter
if result.name
result.name.each_with_index do |name, index|
if @name_stack[index] != name
@name_stack = []
if name != result.name.last
message = name
else

View File

@ -34,6 +34,14 @@ module Flowerbox::Result
@data['stack'] || []
end
def filtered_stack
stack.collect do |line|
line.gsub(%r{\.coffee:(\d+)}) do |_|
".coffee:~#{($1.to_i * 0.67 + 1).to_i}"
end
end
end
def first_local_stack
@first_local_stack ||= stack[1..-1].find do |line|
!system_files.any? { |file| line[%r{\(#{file}}] }

View File

@ -57,7 +57,20 @@ module Flowerbox
puts "Flowerbox running your #{Flowerbox.test_environment.name} tests on #{console_name}..."
server.start
attempts = 3
while true
begin
server.start
break
rescue Flowerbox::Server::ServerDiedError
attempts -= 1
raise RunnerDiedError.new if attempts == 0
Flowerbox.server = nil
end
end
yield

View File

@ -8,6 +8,8 @@ module Flowerbox
class Server
attr_reader :options
class ServerDiedError < StandardError ; end
def initialize(options = {})
@options = { :logging => false }.merge(options || {})
end
@ -39,7 +41,7 @@ module Flowerbox
sleep 0.1
end
raise StandardError.new("Server died") if !@server_thread[:server].running?
raise ServerDiedError.new if !@server_thread[:server].running?
end
def stop

View File

@ -39,7 +39,7 @@ module Flowerbox
return @environment if @environment
@environment = Sprockets::Environment.new
@environment.cache = Sprockets::Cache::FileStore.new(Flowerbox::CACHE_DIR)
@environment.cache = Sprockets::Cache::FileStore.new(Flowerbox.cache_dir)
self.class.gem_asset_paths.each { |path| append_path(path) }
options[:asset_paths].each { |path| append_path(path) }