tconsole 1.1.0pre12 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +96 -25
- data/lib/tconsole/minitest_handler.rb +2 -2
- data/lib/tconsole/version.rb +1 -1
- metadata +9 -9
data/README.md
CHANGED
@@ -1,18 +1,24 @@
|
|
1
|
-
|
1
|
+
TConsole
|
2
2
|
======
|
3
3
|
|
4
|
-
|
4
|
+
TConsole is a testing console for Rails. It allows you to issue commands
|
5
5
|
concerning what tests to run, and see their test output. It's also got a
|
6
6
|
helpful reload command for when your Rails environment needs to be
|
7
7
|
restarted.
|
8
8
|
|
9
|
-
|
9
|
+
TConsole should work in pretty much any Unix environment and will work with apps running Ruby 1.8.7 and Ruby 1.9.3. It can be run on pretty much any test suite that uses MiniTest, including Rails test suites.
|
10
10
|
|
11
|
-
|
11
|
+
See it in Action
|
12
12
|
------
|
13
|
+
There's a quick screencast on Vimeo about TConsole's basic features: [Meet TConsole!](https://vimeo.com/37641415)
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
Why use TConsole?
|
16
|
+
------
|
17
|
+
|
18
|
+
* A large amount of time is wasted loading the Rails environment each time you run the Rails testing rake tasks. TConsole loads the environment when you start the console and whenever you reload the environment, but doesn't have to reload the environment for each test execution.
|
19
|
+
* The Rails rake task syntax `bundle exec rake test:units TEST=test/unit/user_test.rb` can be pretty verbose when you're running specific tests. Yeah, there are tricks you can use to shorten things up, but still, that's crazy long. tconsole lets you just type `test/unit/user_test.rb` to get that specific test file to run. With TConsole you can just type `UserTest` and the test runs!
|
20
|
+
* TConsole makes it dead simple to review how long your tests are taking to run and pinpoint your slowest running tests.
|
21
|
+
* Re-running failed tests is as easy as typing `!failed` with TConsole.
|
16
22
|
|
17
23
|
What about Spork?
|
18
24
|
------
|
@@ -20,21 +26,21 @@ What about Spork?
|
|
20
26
|
|
21
27
|
What about rspec?
|
22
28
|
------
|
23
|
-
|
24
|
-
of adding support for rspec, but I also don't use rspec all that often,
|
25
|
-
so it likely wouldn't be very well tested. If enough people fuss at me,
|
26
|
-
or if someone were willing to add and maintain rspec support I'd definitely be
|
27
|
-
willing to merge it in, though.
|
29
|
+
We've decided to focus on integrating with MiniTest as tightly as possible, rather than worrying about rspec support.
|
28
30
|
|
29
|
-
Installing
|
31
|
+
Installing TConsole
|
30
32
|
------
|
31
|
-
|
33
|
+
gem install tconsole
|
34
|
+
|
35
|
+
Prereleases of TConsole come out pretty frequently. You can install the latest prerelease version with:
|
32
36
|
|
33
|
-
|
37
|
+
gem install tconsole --pre
|
38
|
+
|
39
|
+
If you're using bundler, you probably want to simply add TConsole to your Gemfile:
|
34
40
|
|
35
|
-
|
41
|
+
gem "tconsole"
|
36
42
|
|
37
|
-
How to use
|
43
|
+
How to use TConsole
|
38
44
|
------
|
39
45
|
In your shell of choice, cd into your Rails project's directory and then run `bundle exec tconsole` to fire up the console. You should see something like this:
|
40
46
|
|
@@ -66,23 +72,25 @@ Now that you're in the console, let's test out the `all` command! Running `all`
|
|
66
72
|
|
67
73
|
If you want to focus in on a particular subset of your tests, like units, functionals, or integration, just enter that keyword:
|
68
74
|
|
69
|
-
|
75
|
+
> units
|
70
76
|
|
71
|
-
|
77
|
+
> functionals
|
72
78
|
|
73
|
-
|
79
|
+
> integration
|
74
80
|
|
75
81
|
You can also specify to run all tests in a specific class:
|
76
82
|
|
77
|
-
|
83
|
+
> UserTest
|
78
84
|
|
79
|
-
You can
|
85
|
+
You can dig a bit deeper and just run a particular test in that file as
|
80
86
|
well:
|
81
87
|
|
82
|
-
|
88
|
+
> UserTest#test_that_user_is_healthy
|
83
89
|
|
84
90
|
You can list more than just one class or class and method to run, and
|
85
|
-
|
91
|
+
TConsole will run them all.
|
92
|
+
|
93
|
+
> UserTest InvoiceTest SubscriptionTest#test_that_renew_renews_the_subscription
|
86
94
|
|
87
95
|
There are a few special ! commands that use data from past test runs. The `!failed` command will rerun the set of tests that failed during the last run:
|
88
96
|
|
@@ -107,7 +115,16 @@ improve slow tests:
|
|
107
115
|
0.001128s PostTest#test_post's_state_should_change_when_published
|
108
116
|
0.001056s PostTest#test_returning_only_published_posts
|
109
117
|
0.000923s PostTest#test_post_should_have_respond_to_published_appropriately
|
110
|
-
0.
|
118
|
+
0.000770s PostTest#test_post_should_have_a_body
|
119
|
+
|
120
|
+
You can turn on the Fail Fast feature to cause TConsole to stop running
|
121
|
+
tests as soon as the first test fails. To enable fail fast simply enter:
|
122
|
+
|
123
|
+
> set fast on
|
124
|
+
|
125
|
+
In the console. You can disable Fail Fast again with:
|
126
|
+
|
127
|
+
> set fast off
|
111
128
|
|
112
129
|
If you update your environment, maybe by editing your Gemfile or changing one of your application's configuration files, you can use the `reload` command to reload the entire environment:
|
113
130
|
|
@@ -117,12 +134,66 @@ And then finally, you can run the `exit` command to quit:
|
|
117
134
|
|
118
135
|
> exit
|
119
136
|
|
137
|
+
Configuration Files
|
138
|
+
------
|
139
|
+
|
140
|
+
TConsole attempts to load a .tconsole file in your home directory
|
141
|
+
and in your project directory, in that order, to configure your preferred defaults for TConsole. In many situations you won't need to edit your TConsole configuration files to run TConsole, because it includes a sane set of defaults and attempts to auto-detect Rails applications.
|
142
|
+
|
143
|
+
Here's a commented example configuration file:
|
144
|
+
|
145
|
+
``` ruby
|
146
|
+
TConsole::Config.run do |config|
|
147
|
+
# Configures the directory where your tests are located
|
148
|
+
config.test_dir = "./test"
|
149
|
+
|
150
|
+
# Include paths that should be added to Ruby's load path
|
151
|
+
config.include_paths = ["./test", "./lib"]
|
152
|
+
|
153
|
+
# Paths that should be preloaded. You'll have to run the reload
|
154
|
+
# command to reload these paths in TConsole
|
155
|
+
config.preload_paths = ["./config/application"]
|
156
|
+
|
157
|
+
# File sets are the named sets of files that can be executed. A file
|
158
|
+
# set named "all" must be included.
|
159
|
+
config.file_sets => {
|
160
|
+
"all" => ["test/**/*_test.rb"],
|
161
|
+
"units" => ["test/units/**/*_test.rb"]
|
162
|
+
}
|
163
|
+
|
164
|
+
# Fail fast specifies whether or not tests should stop executing once
|
165
|
+
# the first failure occurs.
|
166
|
+
config.fail_fast = true
|
167
|
+
|
168
|
+
# Specifies code to be run before loading the environment
|
169
|
+
config.before_load do
|
170
|
+
ENV["RAILS_ENV"] ||= "test"
|
171
|
+
end
|
172
|
+
|
173
|
+
# Specifies code to be run after loading the environment
|
174
|
+
config.after_load do
|
175
|
+
::Rails.application
|
176
|
+
::Rails::Engine.class_eval do
|
177
|
+
def eager_load!
|
178
|
+
# turn off eager_loading
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Specifies code to be run before each test execution
|
184
|
+
config.before_test_run do
|
185
|
+
puts "I'm about to run!!!"
|
186
|
+
end
|
187
|
+
end
|
188
|
+
```
|
189
|
+
|
190
|
+
|
120
191
|
Reporting Issues and Contributing
|
121
192
|
------
|
122
193
|
|
123
194
|
Feel free to report issues in the issue tracker at https://github.com/commondream/tconsole/issues. Be sure to include the versions of Ruby, Rails, and your operating system. For bonus points, fork the project and send me a pull request with the fix for the issue you're seeing.
|
124
195
|
|
125
|
-
|
196
|
+
*How embarrassing?!?! A testing tool with no tests?* At first TConsole was just a bit of experimental code, so test coverage is light. I am working on improving that, though.
|
126
197
|
|
127
198
|
License
|
128
199
|
-----
|
@@ -181,9 +181,9 @@ module TConsole
|
|
181
181
|
self.passes += 1
|
182
182
|
end
|
183
183
|
|
184
|
-
results.failures << id unless result == "P"
|
184
|
+
results.failures << id unless result == "P" || result == "S"
|
185
185
|
|
186
|
-
if config.fail_fast && result != "P"
|
186
|
+
if config.fail_fast && result != "P" && result != "S"
|
187
187
|
@failed_fast = true
|
188
188
|
end
|
189
189
|
|
data/lib/tconsole/version.rb
CHANGED
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tconsole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Alan Johnson
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: term-ansicolor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70183807578140 !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: *
|
24
|
+
version_requirements: *70183807578140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: minitest
|
27
|
-
requirement: &
|
27
|
+
requirement: &70183807577640 !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: *
|
35
|
+
version_requirements: *70183807577640
|
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
|
@@ -78,9 +78,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
79
|
none: false
|
80
80
|
requirements:
|
81
|
-
- - ! '
|
81
|
+
- - ! '>='
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: '0'
|
84
84
|
requirements: []
|
85
85
|
rubyforge_project: tconsole
|
86
86
|
rubygems_version: 1.8.11
|