guard-test 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.4.2 - November 19, 2011 - ([@rymai][])
2
+
3
+ ### Bug fix:
4
+
5
+ - [#19](https://github.com/guard/guard-test/issues/19): Fixed "superclass mismatch for class Test (TypeError)" thanks to [@gertas][].
6
+
1
7
  ## 0.4.1 - November 3, 2011 - ([@rymai][])
2
8
 
3
9
  ### Bugs fixes:
@@ -96,6 +102,7 @@
96
102
 
97
103
  [@Ask11]: https://github.com/Ask11
98
104
  [@dasch]: https://github.com/dasch
105
+ [@gertas]: https://github.com/gertas
99
106
  [@gregorymostizky]: https://github.com/gregorymostizky
100
107
  [@jgrau]: https://github.com/jgrau
101
108
  [@rymai]: https://github.com/rymai
@@ -9,35 +9,31 @@ require 'notifier'
9
9
  #
10
10
  # This class inherits from Test::Unit' standard console TestRunner
11
11
  # I'm just overriding some callbacks methods to strip some outputs and display a notification on end
12
- module Guard
13
- class Test
14
- class GuardTestRunner < ::Test::Unit::UI::Console::TestRunner
15
-
16
- def initialize(suite, options = {})
17
- super
18
- @color_scheme["pass"] = ::Test::Unit::Color.new("green", :foreground => true, :bold => true)
19
- @color_scheme["failure"] = ::Test::Unit::Color.new("red", :foreground => true, :bold => true)
20
- end
21
-
22
- protected
23
-
24
- # Test::Unit::UI::Console::TestRunner overrided methods
25
- def setup_mediator
26
- @mediator = ::Test::Unit::UI::TestRunnerMediator.new(@suite)
27
- end
28
-
29
- def finished(elapsed_time)
30
- super
31
- ::Guard::TestNotifier.notify(@result, elapsed_time)
32
- nl
33
- end
34
-
35
- def fault_color_name(fault)
36
- fault.class.name.split(/::/).last.downcase.to_sym
37
- end
38
-
39
- end
12
+ class GuardTestRunner < ::Test::Unit::UI::Console::TestRunner
13
+
14
+ def initialize(suite, options = {})
15
+ super
16
+ @color_scheme["pass"] = ::Test::Unit::Color.new("green", :foreground => true, :bold => true)
17
+ @color_scheme["failure"] = ::Test::Unit::Color.new("red", :foreground => true, :bold => true)
40
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 finished(elapsed_time)
28
+ super
29
+ ::Guard::Test::Notifier.notify(@result, elapsed_time)
30
+ nl
31
+ end
32
+
33
+ def fault_color_name(fault)
34
+ fault.class.name.split(/::/).last.downcase.to_sym
35
+ end
36
+
41
37
  end
42
38
 
43
- Test::Unit::AutoRunner.register_runner(:guard) { |r| Guard::Test::GuardTestRunner }
39
+ Test::Unit::AutoRunner.register_runner(:guard) { |r| GuardTestRunner }
@@ -1,41 +1,45 @@
1
1
  # encoding: utf-8
2
+ require 'rubygems'
2
3
  require 'guard'
4
+ require 'guard/guard'
3
5
  require 'guard/notifier'
4
6
 
5
7
  module Guard
6
- module TestNotifier
8
+ class Test < Guard
9
+ module Notifier
7
10
 
8
- class << self
9
- def notify(result, elapsed_time)
10
- ::Guard::Notifier.notify(
11
- summary(result) + "\n\n" + duration(elapsed_time),
12
- :title => "Test::Unit results",
13
- :image => result.failure_count > 0 ? :failed : :success
14
- )
15
- end
11
+ class << self
12
+ def notify(result, elapsed_time)
13
+ ::Guard::Notifier.notify(
14
+ summary(result) + "\n\n" + duration(elapsed_time),
15
+ :title => "Test::Unit results",
16
+ :image => result.failure_count > 0 ? :failed : :success
17
+ )
18
+ end
16
19
 
17
- private
20
+ private
18
21
 
19
- def summary(result)
20
- "#{result.run_count} test#{'s' if result.run_count != 1}, " \
21
- "#{result.assertion_count} assert#{'s' if result.assertion_count != 1}, " \
22
- "#{result.failure_count} fail#{'s' if result.failure_count != 1}, " \
23
- "#{result.error_count} error#{'s' if result.error_count != 1}"
24
- end
22
+ def summary(result)
23
+ "#{result.run_count} test#{'s' if result.run_count != 1}, " +
24
+ "#{result.assertion_count} assert#{'s' if result.assertion_count != 1}, " +
25
+ "#{result.failure_count} fail#{'s' if result.failure_count != 1}, " +
26
+ "#{result.error_count} error#{'s' if result.error_count != 1}"
27
+ end
25
28
 
26
- def duration(duration, options={})
27
- "Finished in #{round_float(duration)} seconds"
28
- end
29
+ def duration(duration, options = {})
30
+ "Finished in #{round_float(duration)} seconds"
31
+ end
29
32
 
30
- def round_float(float, decimals=4)
31
- if Float.instance_method(:round).arity == 0 # Ruby 1.8
32
- factor = 10**decimals
33
- (float*factor).round / factor.to_f
34
- else # Ruby 1.9
35
- float.round(decimals)
33
+ def round_float(float, decimals = 4)
34
+ if Float.instance_method(:round).arity == 0 # Ruby 1.8
35
+ factor = 10**decimals
36
+ (float*factor).round / factor.to_f
37
+ else # Ruby 1.9
38
+ float.round(decimals)
39
+ end
36
40
  end
37
41
  end
38
- end
39
42
 
43
+ end
40
44
  end
41
- end
45
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Guard
3
3
  module TestVersion
4
- VERSION = "0.4.1" unless defined? TestVersion::VERSION
4
+ VERSION = "0.4.2" unless defined? TestVersion::VERSION
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-03 00:00:00.000000000Z
12
+ date: 2011-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: &2155160420 !ruby/object:Gem::Requirement
16
+ requirement: &70255487678060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.4'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2155160420
24
+ version_requirements: *70255487678060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: test-unit
27
- requirement: &2155159760 !ruby/object:Gem::Requirement
27
+ requirement: &70255487677600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.2'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2155159760
35
+ version_requirements: *70255487677600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &2155159080 !ruby/object:Gem::Requirement
38
+ requirement: &70255487677140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2155159080
46
+ version_requirements: *70255487677140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &2155158480 !ruby/object:Gem::Requirement
49
+ requirement: &70255487676680 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '2.6'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2155158480
57
+ version_requirements: *70255487676680
58
58
  description: Guard::Test automatically run your tests on file modification.
59
59
  email:
60
60
  - rymai@rymai.me