mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
DEV: make autospec compatible with rspec 3
This commit is contained in:
parent
82cc467d93
commit
b0306fd613
3 changed files with 14 additions and 14 deletions
|
@ -4,6 +4,8 @@ module Autospec; end
|
|||
|
||||
class Autospec::Formatter < RSpec::Core::Formatters::BaseTextFormatter
|
||||
|
||||
RSpec::Core::Formatters.register self, :example_passed, :example_pending, :example_failed, :start_dump
|
||||
|
||||
RSPEC_RESULT = "./tmp/rspec_result"
|
||||
|
||||
def initialize(output)
|
||||
|
@ -17,30 +19,27 @@ class Autospec::Formatter < RSpec::Core::Formatters::BaseTextFormatter
|
|||
@fail_file = File.open(RSPEC_RESULT,"w")
|
||||
end
|
||||
|
||||
def example_passed(example)
|
||||
super
|
||||
output.print success_color(".")
|
||||
def example_passed(_notification)
|
||||
output.print RSpec::Core::Formatters::ConsoleCodes.wrap('.', :success)
|
||||
end
|
||||
|
||||
def example_pending(example)
|
||||
super
|
||||
output.print pending_color("*")
|
||||
def example_pending(_notification)
|
||||
output.print RSpec::Core::Formatters::ConsoleCodes.wrap('*', :pending)
|
||||
end
|
||||
|
||||
def example_failed(example)
|
||||
super
|
||||
output.print failure_color("F")
|
||||
@fail_file.puts(example.metadata[:location] + " ")
|
||||
def example_failed(notification)
|
||||
output.print RSpec::Core::Formatters::ConsoleCodes.wrap('F', :failure)
|
||||
@fail_file.puts(notification.example.metadata[:location] + " ")
|
||||
@fail_file.flush
|
||||
end
|
||||
|
||||
def start_dump
|
||||
super
|
||||
def start_dump(notification)
|
||||
output.puts
|
||||
end
|
||||
|
||||
def close
|
||||
def close(filename)
|
||||
@fail_file.close
|
||||
super(filename)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -134,6 +134,7 @@ class Autospec::Manager
|
|||
@queue.shift if current[0] == "focus"
|
||||
# focus on the first 10 failed specs
|
||||
failed_specs = runner.failed_specs[0..10]
|
||||
puts "@@@@@@@@@@@@ failed_spces --> #{failed_specs}" if @debug
|
||||
# focus on the failed specs
|
||||
@queue.unshift ["focus", failed_specs.join(" "), runner] if failed_specs.length > 0
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ desc "Run all specs automatically as needed"
|
|||
task "autospec" => :environment do
|
||||
require 'autospec/manager'
|
||||
|
||||
debug = ARGV.any? { |a| a == "d" || a == "debug" }
|
||||
debug = ARGV.any?{ |a| a == "d" || a == "debug" } || ENV["DEBUG"]
|
||||
force_polling = ARGV.any? { |a| a == "p" || a == "polling" }
|
||||
latency = ((ARGV.find { |a| a =~ /l=|latency=/ } || "").split("=")[1] || 3).to_i
|
||||
|
||||
|
|
Loading…
Reference in a new issue