guard-test 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +20 -12
- data/README.md +23 -45
- data/lib/guard/test/guard_test_runner.rb +48 -0
- data/lib/guard/test/{runners/default_test_unit_runner.rbc → guard_test_runner.rbc} +596 -568
- data/lib/guard/test/inspector.rbc +473 -161
- data/lib/guard/test/notifier.rb +30 -7
- data/lib/guard/test/notifier.rbc +680 -60
- data/lib/guard/test/runner.rb +43 -28
- data/lib/guard/test/runner.rbc +412 -703
- data/lib/guard/test/templates/Guardfile +1 -1
- data/lib/guard/test/version.rb +1 -1
- data/lib/guard/test/version.rbc +61 -11
- data/lib/guard/test.rb +1 -1
- data/lib/guard/test.rbc +245 -142
- metadata +14 -22
- data/lib/guard/test/result_helpers.rb +0 -28
- data/lib/guard/test/result_helpers.rbc +0 -798
- data/lib/guard/test/runners/default_guard_test_runner.rb +0 -64
- data/lib/guard/test/runners/default_guard_test_runner.rbc +0 -1442
- data/lib/guard/test/runners/fastfail_guard_test_runner.rb +0 -29
- data/lib/guard/test/runners/fastfail_guard_test_runner.rbc +0 -596
- data/lib/guard/test/runners/fastfail_test_unit_runner.rbc +0 -562
- data/lib/guard/test/ui.rb +0 -38
- data/lib/guard/test/ui.rbc +0 -1053
@@ -1,64 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
$:.push File.expand_path('../../../', File.dirname(__FILE__))
|
3
|
-
|
4
|
-
require 'test/unit/ui/console/testrunner'
|
5
|
-
require 'guard/test/ui'
|
6
|
-
require 'guard/test/notifier'
|
7
|
-
|
8
|
-
# Thanks to Adam Sanderson for the really good starting point:
|
9
|
-
# http://endofline.wordpress.com/2008/02/11/a-custom-testrunner-to-scratch-an-itch/
|
10
|
-
#
|
11
|
-
# This class inherits from Test::Unit' standard console TestRunner
|
12
|
-
# I'm just overriding some callbacks methods to display some nicer results
|
13
|
-
class DefaultGuardTestRunner < Test::Unit::UI::Console::TestRunner
|
14
|
-
|
15
|
-
def initialize(suite, options={})
|
16
|
-
super
|
17
|
-
@use_color = true
|
18
|
-
end
|
19
|
-
|
20
|
-
protected
|
21
|
-
|
22
|
-
# Test::Unit::UI::Console::TestRunner overrided methods
|
23
|
-
def setup_mediator
|
24
|
-
@mediator = Test::Unit::UI::TestRunnerMediator.new(@suite)
|
25
|
-
end
|
26
|
-
|
27
|
-
def started(result)
|
28
|
-
@result = result
|
29
|
-
nl
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_started(name)
|
33
|
-
# silence!
|
34
|
-
end
|
35
|
-
|
36
|
-
def add_fault(fault)
|
37
|
-
@faults << fault
|
38
|
-
Guard::TestUI.color_print(fault.single_character_display, :color => fault_color_name(fault))
|
39
|
-
@was_faulty = true
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_finished(name)
|
43
|
-
Guard::TestUI.color_print(".", :color => :pass) unless @was_faulty
|
44
|
-
@was_faulty = false
|
45
|
-
end
|
46
|
-
|
47
|
-
def finished(elapsed_time)
|
48
|
-
Guard::TestNotifier.notify(@result, elapsed_time)
|
49
|
-
nl;nl
|
50
|
-
@faults.each_with_index do |fault, index|
|
51
|
-
Guard::TestUI.color_puts("%3d) %s" % [index + 1, fault.long_display], :color => fault_color_name(fault))
|
52
|
-
nl
|
53
|
-
end
|
54
|
-
Guard::TestUI.results(@result, elapsed_time)
|
55
|
-
nl
|
56
|
-
end
|
57
|
-
|
58
|
-
def fault_color_name(fault)
|
59
|
-
fault.class.name.split(/::/).last.downcase.to_sym
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
Test::Unit::AutoRunner.register_runner(:"guard-default") { |r| DefaultGuardTestRunner }
|