tconsole 1.2.2 → 1.2.3

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.
data/cibuild ADDED
@@ -0,0 +1,4 @@
1
+ mkdir -p vendor
2
+ bundle install --path vendor/gems --binstubs
3
+
4
+ rake test
@@ -1,6 +1,6 @@
1
1
  module TConsole
2
2
  class MiniTestHandler
3
- def self.run(match_patterns, config)
3
+ def self.setup(match_patterns, config)
4
4
  # Make sure we have a recent version of minitest, and use it
5
5
  if ::MiniTest::Unit.respond_to?(:runner=)
6
6
  ::MiniTest::Unit.runner = TConsole::MiniTestUnit.new(match_patterns, config)
@@ -8,14 +8,7 @@ module TConsole
8
8
  raise "MiniTest v#{MiniTest::Unit::VERSION} is not compatible with tconsole. Please load a more recent version of MiniTest"
9
9
  end
10
10
 
11
- # Run it
12
- runner = ::MiniTest::Unit.runner
13
- runner.run
14
-
15
- # Make sure that minitest doesn't run automatically when the process exits
16
- patch_minitest
17
-
18
- runner.results
11
+ ::MiniTest::Unit.runner
19
12
  end
20
13
 
21
14
  # Preloads our element cache for autocompletion. Assumes tests are already loaded
@@ -62,7 +55,7 @@ module TConsole
62
55
  "P" => ::Term::ANSIColor.green
63
56
  }
64
57
 
65
- attr_accessor :match_patterns, :config, :results, :passes
58
+ attr_accessor :match_patterns, :config, :results, :passes, :interrupted
66
59
 
67
60
  def initialize(match_patterns, config)
68
61
  self.match_patterns = match_patterns
@@ -158,7 +151,7 @@ module TConsole
158
151
  suite_id = results.elements[suite.to_s]
159
152
 
160
153
  # If we're using failed fast mode and we already failed, just return
161
- skip = true if @failed_fast
154
+ skip = true if @failed_fast || interrupted
162
155
 
163
156
  # If we've got match patterns, see if this matches them
164
157
  if !match_patterns.empty?
@@ -115,14 +115,6 @@ module TConsole
115
115
 
116
116
  self.last_result = run_in_fork do
117
117
 
118
- # handle trapping interrupts
119
- trap("SIGINT") do
120
- puts
121
- puts "Trapped interrupt. Exiting tests."
122
-
123
- exit(1)
124
- end
125
-
126
118
  paths.each do |path|
127
119
  config.trace("Requested path `#{path}` doesn't exist.") unless File.exist?(path)
128
120
  require File.expand_path(path)
@@ -138,8 +130,29 @@ module TConsole
138
130
  require File.join(File.dirname(__FILE__), "minitest_handler")
139
131
 
140
132
  config.trace("Running tests.")
141
- result = MiniTestHandler.run(match_patterns, config)
133
+ runner = MiniTestHandler.setup(match_patterns, config)
134
+
135
+ # Handle trapping interrupts
136
+ trap("SIGINT") do
137
+ puts
138
+ puts "Trapped interrupt. Halting tests."
139
+
140
+ runner.interrupted = true
141
+ end
142
+
143
+ runner.run
144
+
145
+ result = runner.results
146
+
147
+ # Make sure minitest doesn't run automatically
148
+ MiniTestHandler.patch_minitest
149
+
142
150
  config.trace("Finished running tests.")
151
+
152
+ if runner.interrupted
153
+ puts ::Term::ANSIColor.red("Test run was interrupted.")
154
+ end
155
+
143
156
  elsif defined?(::Test::Unit)
144
157
  puts "Sorry, but tconsole doesn't support Test::Unit yet"
145
158
  elsif defined?(::RSpec)
@@ -160,7 +173,7 @@ module TConsole
160
173
  end
161
174
 
162
175
  puts
163
- puts "Test time (including load): #{"%0.6f" % time}s"
176
+ puts "Tests ran in #{"%0.6f" % time}s. Finished at #{Time.now.strftime('%Y-%m-%d %l:%M:%S %p')}."
164
177
  puts
165
178
  end
166
179
 
@@ -1,3 +1,3 @@
1
1
  module TConsole
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tconsole
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
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: 2012-05-24 00:00:00.000000000 Z
12
+ date: 2012-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: term-ansicolor
16
- requirement: &70175839954960 !ruby/object:Gem::Requirement
16
+ requirement: &70247970275880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.7
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70175839954960
24
+ version_requirements: *70247970275880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &70175839954360 !ruby/object:Gem::Requirement
27
+ requirement: &70247970274560 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 2.11.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70175839954360
35
+ version_requirements: *70247970274560
36
36
  description: ! " tconsole allows Rails developers to easily and quickly run their
37
37
  tests as a whole or in subsets. It forks the testing processes from\n a preloaded
38
38
  test environment to ensure that developers don't have to reload their entire Rails
@@ -50,6 +50,7 @@ files:
50
50
  - README.md
51
51
  - Rakefile
52
52
  - bin/tconsole
53
+ - cibuild
53
54
  - lib/tconsole.rb
54
55
  - lib/tconsole/config.rb
55
56
  - lib/tconsole/console.rb