dohtest 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dohtest/stream_output.rb +9 -8
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8df6976f81e9a4acbd2f713cd9ff2e67a3cca0ad
4
- data.tar.gz: 48a552d7689a2c2b524c12aca3e18476520c0e18
3
+ metadata.gz: e47f88244a0039b34c8ea5904841c5d2e238b4e6
4
+ data.tar.gz: 8f48928e629f204d697f23a8f90b0dba60b9e6d2
5
5
  SHA512:
6
- metadata.gz: 65f4a06544c0913c4b15e7d754554f13f1bc653c368e06d16cb56baffeab8d73f694cf6d3681359bddefa0b11ef47654589597d893ec7329c3961da7f62d754c
7
- data.tar.gz: c3a2aaeaa88078aef142c547c31fc3e5a51bc2b5069648fe081be79d05cbebff98585a9816c3729df0be1a896e852f6fb66ac65686b461675f4d2721289709fe
6
+ metadata.gz: 441f22bc4860b091ddd9ffeab3bd7b7503930cdaf95ddf6c56745b05b445a2e6860e6e44a8bb8a3a5270e6fc9ded344dc53291c0da202e1fd200c5b8b5fdd1e7
7
+ data.tar.gz: 2f8744d2a17f0d4fa573116fc9dd2d362f6b63922aa31972632e2623f97c6120a6449a2aef94d2a015d9ad4ca0a929089a03ecb6e4f84066507d54afb937cb38
@@ -7,17 +7,18 @@ module DohTest
7
7
  class StreamOutput
8
8
  DEFAULT_COLORS = {:failure => :red, :error => :magenta, :info => :blue, :success => :green}.freeze
9
9
 
10
- def initialize
10
+ def initialize(ios = nil)
11
11
  @error_count = @groups_ran = @groups_skipped = @tests_ran = @tests_skipped = @assertions_failed = @assertions_passed = 0
12
12
  @callback_succeeded = true
13
13
  @badness = Set.new
14
+ @ios = ios || $stdout
14
15
  end
15
16
 
16
17
  def run_begin(config)
17
18
  @config = config
18
- puts "running tests with config: #{config}"
19
+ @ios.puts "running tests with config: #{config}"
19
20
 
20
- has_terminal = $stdout.tty?
21
+ has_terminal = @ios.tty?
21
22
  @no_color = !has_terminal || @config[:no_color]
22
23
  @verbose = (has_terminal && !@config[:quiet]) || @config[:verbose]
23
24
  end
@@ -28,9 +29,9 @@ class StreamOutput
28
29
  if duration >= 1
29
30
  tests_per_second = (@tests_ran / duration).round(2)
30
31
  assertions_per_second = (total_assertions / duration).round(2)
31
- puts "\n\ncompleted in #{duration.round(2)}s, #{tests_per_second} tests/s, #{assertions_per_second} assertions/s"
32
+ @ios.puts "\n\ncompleted in #{duration.round(2)}s, #{tests_per_second} tests/s, #{assertions_per_second} assertions/s"
32
33
  else
33
- puts "\n\ncompleted in #{duration.round(2)}s"
34
+ @ios.puts "\n\ncompleted in #{duration.round(2)}s"
34
35
  end
35
36
 
36
37
  if @error_count == 0
@@ -66,7 +67,7 @@ class StreamOutput
66
67
 
67
68
  msg = "#{error_str}; #{group_str}; #{test_str}; #{assertion_str}"
68
69
  msg = colorize(:success, msg) if success
69
- puts msg
70
+ @ios.puts msg
70
71
 
71
72
  # this is to generate an exit code; true translates to 0, false to 1
72
73
  success
@@ -81,7 +82,7 @@ class StreamOutput
81
82
  if tests_skipped > 0
82
83
  @groups_skipped += 1
83
84
  else
84
- puts colorize(:info, "no tests defined in #{group_name}")
85
+ @ios.puts colorize(:info, "no tests defined in #{group_name}")
85
86
  end
86
87
  return
87
88
  end
@@ -90,7 +91,7 @@ class StreamOutput
90
91
  total_assertions = assertions_passed + assertions_failed
91
92
  if @verbose
92
93
  skipped_str = if tests_skipped > 0 then ": #{tests_ran} ran, #{tests_skipped} skipped" else '' end
93
- puts "success in #{group_name}: #{total_tests} tests#{skipped_str}; #{total_assertions} assertions" unless @badness.include?(group_name)
94
+ @ios.puts "success in #{group_name}: #{total_tests} tests#{skipped_str}; #{total_assertions} assertions" unless @badness.include?(group_name)
94
95
  end
95
96
  end
96
97
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dohtest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Makani Mason
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-11 00:00:00.000000000 Z
12
+ date: 2013-06-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dohroot
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - '>='
79
79
  - !ruby/object:Gem::Version
80
- version: 1.9.2
80
+ version: 1.9.3
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - '>='