Commit 2426f95c authored by Fabio Pelosin's avatar Fabio Pelosin

[Specs] Improved output.

parent fe461952
...@@ -12,7 +12,7 @@ $:.unshift((ROOT + 'lib').to_s) ...@@ -12,7 +12,7 @@ $:.unshift((ROOT + 'lib').to_s)
require 'cocoapods' require 'cocoapods'
$:.unshift((ROOT + 'spec').to_s) $:.unshift((ROOT + 'spec').to_s)
require 'spec_helper/color_output' require 'spec_helper/bacon'
require 'spec_helper/command' require 'spec_helper/command'
require 'spec_helper/fixture' require 'spec_helper/fixture'
require 'spec_helper/github' require 'spec_helper/github'
...@@ -20,39 +20,20 @@ require 'spec_helper/temporary_directory' ...@@ -20,39 +20,20 @@ require 'spec_helper/temporary_directory'
require 'spec_helper/temporary_repos' require 'spec_helper/temporary_repos'
module Bacon module Bacon
extend ColorOutput
summary_at_exit
module FilterBacktraces
def handle_summary
ErrorLog.replace(ErrorLog.split("\n").reject do |line|
line =~ %r{(gems/mocha|spec_helper)}
end.join("\n").lstrip << "\n\n")
super
end
end
extend FilterBacktraces
class Context class Context
include Pod::Config::Mixin include Pod::Config::Mixin
include SpecHelper::Fixture include SpecHelper::Fixture
def argv(*argv) def argv(*argv)
Pod::Command::ARGV.new(argv) Pod::Command::ARGV.new(argv)
end end
require 'colored'
def xit(description, *args)
puts "- #{description} [DISABLED]".yellow
ErrorLog << "[DISABLED] #{self.name} #{description}\n\n"
end
end end
end end
config = Pod::Config.instance config = Pod::Config.instance
config.silent = true config.silent = true
config.repos_dir = SpecHelper.tmp_repos_path config.repos_dir = SpecHelper.tmp_repos_path
Pod::Specification::Statistics.instance.cache_file = nil
require 'tmpdir' require 'tmpdir'
...@@ -85,5 +66,3 @@ VCR.configure do |c| ...@@ -85,5 +66,3 @@ VCR.configure do |c|
c.allow_http_connections_when_no_cassette = true c.allow_http_connections_when_no_cassette = true
end end
Pod::Specification::Statistics.instance.cache_file = nil
module Bacon
summary_at_exit
@needs_first_put = true
module ColorOutput
# Graciously yanked from https://github.com/zen-cms/Zen-Core and subsequently modified
# MIT License
# Thanks, YorickPeterse! #:nodoc:
def handle_specification(name)
if @needs_first_put
@needs_first_put = false
puts
end
@specs_depth = @specs_depth || 0
puts spaces + name
@specs_depth += 1
yield
@specs_depth -= 1
puts if @specs_depth.zero?
end
#:nodoc:
def handle_requirement(description, disabled = false)
error = yield
if !error.empty?
puts "#{spaces}\e[31m- #{description} [FAILED]\e[0m"
elsif disabled
puts "#{spaces}\e[33m- #{description} [DISABLED]\e[0m"
else
puts "#{spaces}\e[32m- #{description}\e[0m"
end
end
#:nodoc:
def handle_summary
print ErrorLog if Backtraces
puts "%d specifications (%d requirements), %d failures, %d errors" %
Counter.values_at(:specifications, :requirements, :failed, :errors)
end
#:nodoc:
def spaces
return ' ' * @specs_depth
end
end
extend ColorOutput
module FilterBacktraces
def handle_summary
ErrorLog.replace(ErrorLog.split("\n").reject do |line|
line =~ %r{(gems/mocha|spec_helper)}
end.join("\n").lstrip << "\n\n")
super
end
end
extend FilterBacktraces
class Context
def xit(description, *args)
Bacon.handle_requirement(description, true) {[]}
title = "\e[33m-> Disabled Specificiations\e[0m"
ErrorLog.insert(0,"#{title}\n") unless ErrorLog.include?(title)
ErrorLog.insert(title.length, "\n - #{self.name} #{description}")
end
end
end
# Graciously yanked from https://github.com/zen-cms/Zen-Core
# MIT License
# Thanks, YorickPeterse!
#:nodoc:
module Bacon
#:nodoc:
module ColorOutput
#:nodoc:
def handle_specification(name)
puts spaces + name
yield
puts if Counter[:context_depth] == 1
end
#:nodoc:
def handle_requirement(description)
error = yield
if !error.empty?
puts "#{spaces} \e[31m- #{description} [FAILED]\e[0m"
else
puts "#{spaces} \e[32m- #{description}\e[0m"
end
end
#:nodoc:
def handle_summary
print ErrorLog if Backtraces
puts "%d specifications (%d requirements), %d failures, %d errors" %
Counter.values_at(:specifications, :requirements, :failed, :errors)
end
#:nodoc:
def spaces
if Counter[:context_depth] == 0
Counter[:context_depth] = 1
end
return ' ' * (Counter[:context_depth] - 1)
end
end # ColorOutput
end # Bacon
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment