infinity_test 1.0.2 → 2.0.0.rc1
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.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +31 -0
- data/.gitignore +3 -0
- data/.rspec +2 -2
- data/AI_INTEGRATION_IDEAS.md +203 -0
- data/Gemfile +3 -15
- data/History.markdown +82 -0
- data/INFINITY_TEST +48 -0
- data/LICENSE.txt +2 -2
- data/README.md +627 -0
- data/Rakefile +1 -65
- data/TODO.markdown +26 -9
- data/bin/infinity_test +1 -4
- data/images/fuuu/pending.png +0 -0
- data/images/fuuu/success.png +0 -0
- data/infinity_test.gemspec +41 -191
- data/lib/infinity_test/core/auto_discover.rb +67 -0
- data/lib/infinity_test/core/base.rb +369 -0
- data/lib/infinity_test/core/callback.rb +59 -0
- data/lib/infinity_test/core/changed_file.rb +13 -0
- data/lib/infinity_test/core/command_builder.rb +48 -0
- data/lib/infinity_test/core/command_runner.rb +62 -0
- data/lib/infinity_test/core/configuration_merge.rb +37 -0
- data/lib/infinity_test/core/continuous_test_server.rb +106 -0
- data/lib/infinity_test/core/load_configuration.rb +48 -0
- data/lib/infinity_test/core/notifier.rb +59 -0
- data/lib/infinity_test/core/options.rb +134 -0
- data/lib/infinity_test/core/runner.rb +18 -0
- data/lib/infinity_test/core/version.rb +5 -0
- data/lib/infinity_test/framework/base.rb +57 -0
- data/lib/infinity_test/framework/padrino.rb +33 -0
- data/lib/infinity_test/framework/rails.rb +35 -0
- data/lib/infinity_test/framework/rubygems.rb +29 -0
- data/lib/infinity_test/framework/shared_example.rb +47 -0
- data/lib/infinity_test/observer/base.rb +40 -0
- data/lib/infinity_test/observer/filewatcher.rb +72 -0
- data/lib/infinity_test/observer/listen.rb +74 -0
- data/lib/infinity_test/observer/shared_example.rb +35 -0
- data/lib/infinity_test/old_dsl/configuration.rb +26 -0
- data/lib/infinity_test/strategy/base.rb +34 -0
- data/lib/infinity_test/strategy/rbenv.rb +32 -0
- data/lib/infinity_test/strategy/ruby_default.rb +20 -0
- data/lib/infinity_test/strategy/rvm.rb +50 -0
- data/lib/infinity_test/strategy/shared_example.rb +32 -0
- data/lib/infinity_test/test_framework/base.rb +64 -0
- data/lib/infinity_test/test_framework/rspec.rb +48 -0
- data/lib/infinity_test/test_framework/shared_example.rb +56 -0
- data/lib/infinity_test/test_framework/test_unit.rb +57 -0
- data/lib/infinity_test.rb +53 -35
- data/spec/infinity_test/core/auto_discover_spec.rb +149 -0
- data/spec/infinity_test/core/base_spec.rb +240 -0
- data/spec/infinity_test/core/callback_spec.rb +89 -0
- data/spec/infinity_test/core/changed_file_spec.rb +26 -0
- data/spec/infinity_test/core/command_builder_spec.rb +38 -0
- data/spec/infinity_test/core/configuration_merge_spec.rb +124 -0
- data/spec/infinity_test/core/continuous_test_server_spec.rb +116 -0
- data/spec/infinity_test/core/load_configuration_spec.rb +43 -0
- data/spec/infinity_test/core/notifier_spec.rb +151 -0
- data/spec/infinity_test/core/options_spec.rb +168 -0
- data/spec/infinity_test/core/runner_spec.rb +17 -0
- data/spec/infinity_test/framework/base_spec.rb +55 -0
- data/spec/infinity_test/framework/padrino_spec.rb +36 -0
- data/spec/infinity_test/framework/rails_spec.rb +36 -0
- data/spec/infinity_test/framework/rubygems_spec.rb +34 -0
- data/spec/infinity_test/observer/base_spec.rb +78 -0
- data/spec/infinity_test/observer/filewatcher_spec.rb +51 -0
- data/spec/infinity_test/observer/listen_spec.rb +50 -0
- data/spec/infinity_test/{builder_spec.rb → strategy/base_spec.rb} +1 -2
- data/spec/infinity_test/strategy/rbenv_spec.rb +53 -0
- data/spec/infinity_test/strategy/ruby_default_spec.rb +32 -0
- data/spec/infinity_test/strategy/rvm_spec.rb +69 -0
- data/spec/infinity_test/test_framework/rspec_spec.rb +119 -0
- data/spec/infinity_test/test_framework/test_unit_spec.rb +193 -0
- data/spec/spec_helper.rb +34 -119
- metadata +276 -205
- data/.infinity_test +0 -36
- data/.rvmrc +0 -1
- data/Gemfile.lock +0 -62
- data/Readme.markdown +0 -122
- data/Tasks +0 -4
- data/VERSION.yml +0 -5
- data/buzz_images/buzz_lightyear.jpg +0 -0
- data/buzz_images/buzz_lightyear_continencia.gif +0 -0
- data/buzz_images/to_infinity_and_beyond.png +0 -0
- data/features/heuristics.feature +0 -23
- data/features/support/env.rb +0 -2
- data/images/fuuu/sucess.png +0 -0
- data/lib/infinity_test/application.rb +0 -355
- data/lib/infinity_test/application_library/rails.rb +0 -94
- data/lib/infinity_test/application_library/rubygems.rb +0 -43
- data/lib/infinity_test/binary_path.rb +0 -43
- data/lib/infinity_test/builder.rb +0 -67
- data/lib/infinity_test/command.rb +0 -58
- data/lib/infinity_test/configuration.rb +0 -273
- data/lib/infinity_test/continuous_testing.rb +0 -40
- data/lib/infinity_test/dependencies.rb +0 -80
- data/lib/infinity_test/environment.rb +0 -15
- data/lib/infinity_test/heuristics.rb +0 -36
- data/lib/infinity_test/heuristics_helper.rb +0 -9
- data/lib/infinity_test/options.rb +0 -89
- data/lib/infinity_test/runner.rb +0 -38
- data/lib/infinity_test/test_framework.rb +0 -109
- data/lib/infinity_test/test_library/bacon.rb +0 -55
- data/lib/infinity_test/test_library/cucumber.rb +0 -22
- data/lib/infinity_test/test_library/rspec.rb +0 -58
- data/lib/infinity_test/test_library/test_unit.rb +0 -52
- data/lib/infinity_test/test_unit_loader.rb +0 -5
- data/spec/factories/buzz/lib/buzz.rb +0 -0
- data/spec/factories/buzz/spec/buzz_spec.rb +0 -0
- data/spec/factories/company/Gemfile +0 -0
- data/spec/factories/company/lib/company.rb +0 -0
- data/spec/factories/company/test/company_test.rb +0 -0
- data/spec/factories/images/failure.png +0 -0
- data/spec/factories/images/pending.png +0 -0
- data/spec/factories/images/sucess.png +0 -0
- data/spec/factories/infinity_test +0 -5
- data/spec/factories/infinity_test_example +0 -7
- data/spec/factories/slinky/spec/slinky/slinky_spec.rb +0 -0
- data/spec/factories/travel/lib/travel.rb +0 -0
- data/spec/factories/travel/test/partner_test.rb +0 -0
- data/spec/factories/travel/test/travel_test.rb +0 -0
- data/spec/factories/wood/lib/wood.rb +0 -0
- data/spec/factories/wood/spec/wood_spec.rb +0 -0
- data/spec/infinity_test/application_library/rails_spec.rb +0 -140
- data/spec/infinity_test/application_library/rubygems_spec.rb +0 -52
- data/spec/infinity_test/application_spec.rb +0 -424
- data/spec/infinity_test/binary_path_spec.rb +0 -72
- data/spec/infinity_test/command_spec.rb +0 -53
- data/spec/infinity_test/configuration_spec.rb +0 -377
- data/spec/infinity_test/continuous_testing_spec.rb +0 -25
- data/spec/infinity_test/environment_spec.rb +0 -23
- data/spec/infinity_test/heuristics_helper_spec.rb +0 -15
- data/spec/infinity_test/heuristics_spec.rb +0 -127
- data/spec/infinity_test/options_spec.rb +0 -91
- data/spec/infinity_test/runner_spec.rb +0 -42
- data/spec/infinity_test/test_framework_spec.rb +0 -127
- data/spec/infinity_test/test_library/bacon_spec.rb +0 -150
- data/spec/infinity_test/test_library/cucumber_spec.rb +0 -8
- data/spec/infinity_test/test_library/rspec_spec.rb +0 -185
- data/spec/infinity_test/test_library/test_unit_spec.rb +0 -184
- data/spec/infinity_test_spec.rb +0 -40
- /data/images/faces/{sucess.png → success.png} +0 -0
- /data/images/hands/{sucess.png → success.png} +0 -0
- /data/images/mario_bros/{sucess.jpg → success.jpg} +0 -0
- /data/images/rails/{sucess.png → success.png} +0 -0
- /data/images/rubies/{sucess.png → success.png} +0 -0
- /data/images/simpson/{sucess.jpg → success.jpg} +0 -0
- /data/images/street_fighter/{sucess.jpg → success.jpg} +0 -0
- /data/images/toy_story/{sucess.png → success.png} +0 -0
data/README.md
ADDED
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
# Infinity Test
|
|
2
|
+
|
|
3
|
+
**To Infinity and Beyond!**
|
|
4
|
+
|
|
5
|
+
Infinity Test is a continuous testing library and a flexible alternative to Autotest and Guard. It watches your files for changes and automatically runs your tests, providing instant feedback with desktop notifications.
|
|
6
|
+
|
|
7
|
+
Version 2.0.0 brings a complete rewrite with modern dependencies, multi-Ruby support via RVM/RbEnv, and a powerful callbacks system.
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Quick Start](#quick-start)
|
|
13
|
+
- [Command Line Options](#command-line-options)
|
|
14
|
+
- [Configuration File (INFINITY_TEST)](#configuration-file-infinity_test)
|
|
15
|
+
- [Ruby Version Managers](#ruby-version-managers)
|
|
16
|
+
- [Test Frameworks](#test-frameworks)
|
|
17
|
+
- [Application Frameworks](#application-frameworks)
|
|
18
|
+
- [Notifications](#notifications)
|
|
19
|
+
- [Image Themes](#image-themes)
|
|
20
|
+
- [Callbacks](#callbacks)
|
|
21
|
+
- [File Watching](#file-watching)
|
|
22
|
+
- [Advanced Usage](#advanced-usage)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
gem install infinity_test
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or add to your Gemfile:
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
gem 'infinity_test', group: :development
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then run:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
bundle install
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
48
|
+
### Step 1: Navigate to your project
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
cd /path/to/your/project
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Step 2: Run Infinity Test
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
infinity_test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
That's it! Infinity Test will:
|
|
61
|
+
|
|
62
|
+
1. Auto-detect your test framework (RSpec or Test::Unit)
|
|
63
|
+
2. Auto-detect your application framework (Rails, Padrino, or Rubygems)
|
|
64
|
+
3. Run all tests immediately
|
|
65
|
+
4. Watch for file changes and re-run relevant tests
|
|
66
|
+
5. Show desktop notifications with test results
|
|
67
|
+
|
|
68
|
+
### Step 3: Start coding
|
|
69
|
+
|
|
70
|
+
Edit your files and watch the tests run automatically!
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Command Line Options
|
|
75
|
+
|
|
76
|
+
| Option | Short | Description |
|
|
77
|
+
|--------|-------|-------------|
|
|
78
|
+
| `--ruby strategy` | | Ruby manager strategy: `auto_discover`, `rvm`, `rbenv`, `ruby_default` |
|
|
79
|
+
| `--rubies=versions` | | Ruby versions to test against (comma-separated) |
|
|
80
|
+
| `--test library` | | Test framework: `auto_discover`, `rspec`, `test_unit` |
|
|
81
|
+
| `--framework library` | | Application framework: `auto_discover`, `rails`, `rubygems`, `padrino` |
|
|
82
|
+
| `--options=options` | | Additional options to pass to test command |
|
|
83
|
+
| `--notifications library` | | Notification system: `auto_discover`, `osascript`, `terminal_notifier`, `notify_send`, `dunstify` |
|
|
84
|
+
| `--mode theme` | | Image theme for notifications (see [Image Themes](#image-themes)) |
|
|
85
|
+
| `--no-infinity-and-beyond` | `-n` | Run tests once and exit (CI mode) |
|
|
86
|
+
| `--just-watch` | `-j` | Skip initial test run, only watch for changes |
|
|
87
|
+
| `--focus [FILE]` | `-f` | Focus on specific tests or `failures` for last failed tests |
|
|
88
|
+
| `--no-verbose` | | Don't print commands before executing |
|
|
89
|
+
| `--no-bundler` | | Bypass Bundler support |
|
|
90
|
+
| `--help` | | Show help message |
|
|
91
|
+
|
|
92
|
+
### Examples
|
|
93
|
+
|
|
94
|
+
**Run with RSpec only:**
|
|
95
|
+
```bash
|
|
96
|
+
infinity_test --test rspec
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Run tests on multiple Ruby versions with RVM:**
|
|
100
|
+
```bash
|
|
101
|
+
infinity_test --ruby rvm --rubies=3.0.0,3.1.0,3.2.0
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Run tests once and exit (for CI):**
|
|
105
|
+
```bash
|
|
106
|
+
infinity_test -n
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Skip initial test run, just watch:**
|
|
110
|
+
```bash
|
|
111
|
+
infinity_test --just-watch
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Focus on failed tests:**
|
|
115
|
+
```bash
|
|
116
|
+
infinity_test --focus failures
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Focus on a specific file:**
|
|
120
|
+
```bash
|
|
121
|
+
infinity_test --focus spec/models/user_spec.rb
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Use a specific notification theme:**
|
|
125
|
+
```bash
|
|
126
|
+
infinity_test --mode mario_bros
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Pass additional options to the test runner:**
|
|
130
|
+
```bash
|
|
131
|
+
infinity_test --options="-Ilib -Itest"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Configuration File (INFINITY_TEST)
|
|
137
|
+
|
|
138
|
+
You can persist your settings in an `INFINITY_TEST` file. Infinity Test looks for configuration in two locations:
|
|
139
|
+
|
|
140
|
+
1. **Project file**: `./INFINITY_TEST` (higher priority)
|
|
141
|
+
2. **Global file**: `~/INFINITY_TEST` (lower priority)
|
|
142
|
+
|
|
143
|
+
### Basic Configuration
|
|
144
|
+
|
|
145
|
+
```ruby
|
|
146
|
+
InfinityTest.setup do |config|
|
|
147
|
+
config.test_framework = :rspec
|
|
148
|
+
config.framework = :rails
|
|
149
|
+
config.notifications = :terminal_notifier
|
|
150
|
+
config.mode = :mario_bros
|
|
151
|
+
config.verbose = true
|
|
152
|
+
end
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### All Configuration Options
|
|
156
|
+
|
|
157
|
+
```ruby
|
|
158
|
+
InfinityTest.setup do |config|
|
|
159
|
+
# Ruby Version Manager
|
|
160
|
+
# Options: :auto_discover, :rvm, :rbenv, :ruby_default
|
|
161
|
+
config.strategy = :auto_discover
|
|
162
|
+
|
|
163
|
+
# Ruby versions to test against (requires RVM or RbEnv)
|
|
164
|
+
config.rubies = ['3.0.0', '3.1.0', '3.2.0']
|
|
165
|
+
|
|
166
|
+
# Gemset to use with RVM
|
|
167
|
+
config.gemset = 'my_project'
|
|
168
|
+
|
|
169
|
+
# Test framework
|
|
170
|
+
# Options: :auto_discover, :rspec, :test_unit
|
|
171
|
+
config.test_framework = :rspec
|
|
172
|
+
|
|
173
|
+
# Application framework
|
|
174
|
+
# Options: :auto_discover, :rails, :padrino, :rubygems
|
|
175
|
+
config.framework = :rails
|
|
176
|
+
|
|
177
|
+
# File observer
|
|
178
|
+
# Options: :listen (event-driven), :filewatcher (polling)
|
|
179
|
+
config.observer = :listen
|
|
180
|
+
|
|
181
|
+
# Notification system
|
|
182
|
+
# Options: :auto_discover, :osascript, :terminal_notifier, :notify_send, :dunstify
|
|
183
|
+
config.notifications = :auto_discover
|
|
184
|
+
|
|
185
|
+
# Image theme for notifications
|
|
186
|
+
config.mode = :simpson
|
|
187
|
+
|
|
188
|
+
# Or use custom images
|
|
189
|
+
config.success_image = '/path/to/success.png'
|
|
190
|
+
config.failure_image = '/path/to/failure.png'
|
|
191
|
+
config.pending_image = '/path/to/pending.png'
|
|
192
|
+
|
|
193
|
+
# Bundler support (auto-detected if Gemfile exists)
|
|
194
|
+
config.bundler = true
|
|
195
|
+
|
|
196
|
+
# Print commands before executing
|
|
197
|
+
config.verbose = true
|
|
198
|
+
|
|
199
|
+
# File extension to watch
|
|
200
|
+
config.extension = :rb
|
|
201
|
+
|
|
202
|
+
# Skip initial test run
|
|
203
|
+
config.just_watch = false
|
|
204
|
+
|
|
205
|
+
# Run tests and exit (CI mode)
|
|
206
|
+
config.infinity_and_beyond = true
|
|
207
|
+
|
|
208
|
+
# Focus mode: nil, :failures, or file path
|
|
209
|
+
config.focus = nil
|
|
210
|
+
|
|
211
|
+
# Ignore specific test files
|
|
212
|
+
config.ignore_test_files = [
|
|
213
|
+
'spec/slow/performance_spec.rb'
|
|
214
|
+
]
|
|
215
|
+
|
|
216
|
+
# Ignore test folders
|
|
217
|
+
config.ignore_test_folders = [
|
|
218
|
+
'spec/integration'
|
|
219
|
+
]
|
|
220
|
+
end
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Configuration with Callbacks
|
|
224
|
+
|
|
225
|
+
```ruby
|
|
226
|
+
InfinityTest.setup do |config|
|
|
227
|
+
config.test_framework = :rspec
|
|
228
|
+
config.mode = :faces
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Clear terminal before running tests
|
|
232
|
+
InfinityTest::Core::Base.before(:all) do
|
|
233
|
+
InfinityTest::Core::Base.clear_terminal
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Run after all tests complete
|
|
237
|
+
InfinityTest::Core::Base.after(:all) do
|
|
238
|
+
system('say "Tests finished"')
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Run before each Ruby version (when testing multiple rubies)
|
|
242
|
+
InfinityTest::Core::Base.before(:each_ruby) do |environment|
|
|
243
|
+
puts "Testing with Ruby #{environment[:ruby_version]}"
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Run after each Ruby version
|
|
247
|
+
InfinityTest::Core::Base.after(:each_ruby) do |environment|
|
|
248
|
+
puts "Finished testing Ruby #{environment[:ruby_version]}"
|
|
249
|
+
end
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Ruby Version Managers
|
|
255
|
+
|
|
256
|
+
Infinity Test supports testing across multiple Ruby versions using RVM or RbEnv.
|
|
257
|
+
|
|
258
|
+
### Auto Discovery (Default)
|
|
259
|
+
|
|
260
|
+
```ruby
|
|
261
|
+
config.strategy = :auto_discover
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Priority order: RVM > RbEnv > RubyDefault
|
|
265
|
+
|
|
266
|
+
### RVM Strategy
|
|
267
|
+
|
|
268
|
+
Test against multiple Ruby versions with optional gemset support:
|
|
269
|
+
|
|
270
|
+
```ruby
|
|
271
|
+
InfinityTest.setup do |config|
|
|
272
|
+
config.strategy = :rvm
|
|
273
|
+
config.rubies = ['3.0.0', '3.1.0', 'jruby-9.4.0.0']
|
|
274
|
+
config.gemset = 'infinity_test' # Optional
|
|
275
|
+
end
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Command line:**
|
|
279
|
+
```bash
|
|
280
|
+
infinity_test --ruby rvm --rubies=3.0.0,3.1.0,jruby-9.4.0.0
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### RbEnv Strategy
|
|
284
|
+
|
|
285
|
+
Test against multiple Ruby versions using rbenv:
|
|
286
|
+
|
|
287
|
+
```ruby
|
|
288
|
+
InfinityTest.setup do |config|
|
|
289
|
+
config.strategy = :rbenv
|
|
290
|
+
config.rubies = ['3.0.0', '3.1.0', '3.2.0']
|
|
291
|
+
end
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Command line:**
|
|
295
|
+
```bash
|
|
296
|
+
infinity_test --ruby rbenv --rubies=3.0.0,3.1.0
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Ruby Default Strategy
|
|
300
|
+
|
|
301
|
+
Use the current Ruby version only (no version manager):
|
|
302
|
+
|
|
303
|
+
```ruby
|
|
304
|
+
config.strategy = :ruby_default
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Test Frameworks
|
|
310
|
+
|
|
311
|
+
### RSpec
|
|
312
|
+
|
|
313
|
+
Auto-detected when `spec/` directory exists with `spec_helper.rb` or `*_spec.rb` files.
|
|
314
|
+
|
|
315
|
+
```ruby
|
|
316
|
+
config.test_framework = :rspec
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Test::Unit / Minitest
|
|
320
|
+
|
|
321
|
+
Auto-detected when `test/` directory exists with `test_helper.rb` or `*_test.rb` files.
|
|
322
|
+
|
|
323
|
+
```ruby
|
|
324
|
+
config.test_framework = :test_unit
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Application Frameworks
|
|
330
|
+
|
|
331
|
+
### Rails
|
|
332
|
+
|
|
333
|
+
Auto-detected when `config/environment.rb` exists.
|
|
334
|
+
|
|
335
|
+
**Watched directories:**
|
|
336
|
+
- `app/models` → runs corresponding model specs/tests
|
|
337
|
+
- `app/controllers` → runs corresponding controller specs/tests
|
|
338
|
+
- `app/helpers` → runs corresponding helper specs/tests
|
|
339
|
+
- `app/mailers` → runs corresponding mailer specs/tests
|
|
340
|
+
- `app/jobs` → runs corresponding job specs/tests
|
|
341
|
+
- `lib/` → runs corresponding lib specs/tests
|
|
342
|
+
- `spec/` or `test/` → runs the changed spec/test file
|
|
343
|
+
- `spec_helper.rb` or `test_helper.rb` → runs all tests
|
|
344
|
+
|
|
345
|
+
### Padrino
|
|
346
|
+
|
|
347
|
+
Auto-detected when `config/boot.rb` exists with Padrino reference.
|
|
348
|
+
|
|
349
|
+
Similar heuristics to Rails with Padrino-specific paths.
|
|
350
|
+
|
|
351
|
+
### Rubygems (Default)
|
|
352
|
+
|
|
353
|
+
Used for gem development and simple Ruby projects.
|
|
354
|
+
|
|
355
|
+
**Watched directories:**
|
|
356
|
+
- `lib/` → runs corresponding specs/tests
|
|
357
|
+
- `spec/` or `test/` → runs the changed spec/test file
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Notifications
|
|
362
|
+
|
|
363
|
+
Desktop notifications show test results with themed images.
|
|
364
|
+
|
|
365
|
+
### Notification Systems
|
|
366
|
+
|
|
367
|
+
| System | Platform | Description |
|
|
368
|
+
|--------|----------|-------------|
|
|
369
|
+
| `auto_discover` | All | Automatically detect available notifier |
|
|
370
|
+
| `terminal_notifier` | macOS | Modern macOS notifications |
|
|
371
|
+
| `osascript` | macOS | Built-in AppleScript notifications |
|
|
372
|
+
| `notify_send` | Linux | libnotify notifications |
|
|
373
|
+
| `dunstify` | Linux | Dunst notification daemon |
|
|
374
|
+
|
|
375
|
+
**Configuration:**
|
|
376
|
+
```ruby
|
|
377
|
+
config.notifications = :terminal_notifier
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
**Command line:**
|
|
381
|
+
```bash
|
|
382
|
+
infinity_test --notifications terminal_notifier
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Image Themes
|
|
388
|
+
|
|
389
|
+
Infinity Test includes fun image themes for notifications. Each theme has three images: `success`, `failure`, and `pending`.
|
|
390
|
+
|
|
391
|
+
### Available Themes
|
|
392
|
+
|
|
393
|
+
| Theme | Description | Location |
|
|
394
|
+
|-------|-------------|----------|
|
|
395
|
+
| `simpson` | The Simpsons characters (default) | `images/simpson/` |
|
|
396
|
+
| `faces` | Expressive face icons | `images/faces/` |
|
|
397
|
+
| `fuuu` | Rage comic faces | `images/fuuu/` |
|
|
398
|
+
| `hands` | Hand gesture icons | `images/hands/` |
|
|
399
|
+
| `mario_bros` | Super Mario characters | `images/mario_bros/` |
|
|
400
|
+
| `rails` | Ruby on Rails themed | `images/rails/` |
|
|
401
|
+
| `rubies` | Ruby gemstone themed | `images/rubies/` |
|
|
402
|
+
| `street_fighter` | Street Fighter characters | `images/street_fighter/` |
|
|
403
|
+
| `toy_story` | Toy Story characters | `images/toy_story/` |
|
|
404
|
+
|
|
405
|
+
### Using a Theme
|
|
406
|
+
|
|
407
|
+
**Configuration file:**
|
|
408
|
+
```ruby
|
|
409
|
+
config.mode = :mario_bros
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**Command line:**
|
|
413
|
+
```bash
|
|
414
|
+
infinity_test --mode mario_bros
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Custom Images
|
|
418
|
+
|
|
419
|
+
Use your own images by setting the image paths directly:
|
|
420
|
+
|
|
421
|
+
```ruby
|
|
422
|
+
InfinityTest.setup do |config|
|
|
423
|
+
config.success_image = '/path/to/my_success.png'
|
|
424
|
+
config.failure_image = '/path/to/my_failure.png'
|
|
425
|
+
config.pending_image = '/path/to/my_pending.png'
|
|
426
|
+
end
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
Or point to a custom directory containing `success.*`, `failure.*`, and `pending.*` images:
|
|
430
|
+
|
|
431
|
+
```ruby
|
|
432
|
+
config.mode = '/path/to/my/images/directory'
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Callbacks
|
|
438
|
+
|
|
439
|
+
Callbacks let you run custom code before or after tests.
|
|
440
|
+
|
|
441
|
+
### Available Callbacks
|
|
442
|
+
|
|
443
|
+
| Callback | Scope | Description |
|
|
444
|
+
|----------|-------|-------------|
|
|
445
|
+
| `before(:all)` | All | Runs once before all tests |
|
|
446
|
+
| `after(:all)` | All | Runs once after all tests |
|
|
447
|
+
| `before(:each_ruby)` | Per Ruby | Runs before testing each Ruby version |
|
|
448
|
+
| `after(:each_ruby)` | Per Ruby | Runs after testing each Ruby version |
|
|
449
|
+
|
|
450
|
+
### Examples
|
|
451
|
+
|
|
452
|
+
**Clear terminal before tests:**
|
|
453
|
+
```ruby
|
|
454
|
+
InfinityTest::Core::Base.before(:all) do
|
|
455
|
+
InfinityTest::Core::Base.clear_terminal
|
|
456
|
+
end
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**Play a sound after tests:**
|
|
460
|
+
```ruby
|
|
461
|
+
InfinityTest::Core::Base.after(:all) do
|
|
462
|
+
system('afplay /path/to/sound.mp3')
|
|
463
|
+
end
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**Log Ruby version being tested:**
|
|
467
|
+
```ruby
|
|
468
|
+
InfinityTest::Core::Base.before(:each_ruby) do |env|
|
|
469
|
+
File.write('test.log', "Testing: #{env[:ruby_version]}\n", mode: 'a')
|
|
470
|
+
end
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
**Compile extensions before each Ruby:**
|
|
474
|
+
```ruby
|
|
475
|
+
InfinityTest::Core::Base.before(:each_ruby) do |env|
|
|
476
|
+
system('rake compile')
|
|
477
|
+
end
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
## File Watching
|
|
483
|
+
|
|
484
|
+
### Listen (Default)
|
|
485
|
+
|
|
486
|
+
Event-driven file watching using native OS notifications. Fast and efficient.
|
|
487
|
+
|
|
488
|
+
```ruby
|
|
489
|
+
config.observer = :listen
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### Filewatcher
|
|
493
|
+
|
|
494
|
+
Polling-based file watching. Works everywhere including VMs and NFS mounts.
|
|
495
|
+
|
|
496
|
+
```ruby
|
|
497
|
+
config.observer = :filewatcher
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
## Advanced Usage
|
|
503
|
+
|
|
504
|
+
### Continuous Integration Mode
|
|
505
|
+
|
|
506
|
+
Run tests once and exit with proper exit code:
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
infinity_test -n
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
Or in configuration:
|
|
513
|
+
```ruby
|
|
514
|
+
config.infinity_and_beyond = false
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### Just Watch Mode
|
|
518
|
+
|
|
519
|
+
Skip the initial test run and only watch for changes. Useful for large projects:
|
|
520
|
+
|
|
521
|
+
```bash
|
|
522
|
+
infinity_test --just-watch
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
### Focus Mode
|
|
526
|
+
|
|
527
|
+
Run only specific tests:
|
|
528
|
+
|
|
529
|
+
```bash
|
|
530
|
+
# Run only previously failed tests
|
|
531
|
+
infinity_test --focus failures
|
|
532
|
+
|
|
533
|
+
# Run only a specific file
|
|
534
|
+
infinity_test --focus spec/models/user_spec.rb
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### Ignoring Files
|
|
538
|
+
|
|
539
|
+
```ruby
|
|
540
|
+
InfinityTest.setup do |config|
|
|
541
|
+
# Ignore specific test files
|
|
542
|
+
config.ignore_test_files = [
|
|
543
|
+
'spec/slow/large_integration_spec.rb',
|
|
544
|
+
'spec/external/api_spec.rb'
|
|
545
|
+
]
|
|
546
|
+
|
|
547
|
+
# Ignore entire directories
|
|
548
|
+
config.ignore_test_folders = [
|
|
549
|
+
'spec/integration',
|
|
550
|
+
'spec/system'
|
|
551
|
+
]
|
|
552
|
+
end
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### Watching Non-Ruby Files
|
|
556
|
+
|
|
557
|
+
```ruby
|
|
558
|
+
# Watch Python files
|
|
559
|
+
config.extension = :py
|
|
560
|
+
|
|
561
|
+
# Watch JavaScript files
|
|
562
|
+
config.extension = :js
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### Sample Complete Configuration
|
|
566
|
+
|
|
567
|
+
```ruby
|
|
568
|
+
# INFINITY_TEST
|
|
569
|
+
|
|
570
|
+
InfinityTest.setup do |config|
|
|
571
|
+
# Multi-Ruby testing with RVM
|
|
572
|
+
config.strategy = :rvm
|
|
573
|
+
config.rubies = ['3.1.0', '3.2.0', '3.3.0']
|
|
574
|
+
config.gemset = 'myapp'
|
|
575
|
+
|
|
576
|
+
# Test framework and app framework
|
|
577
|
+
config.test_framework = :rspec
|
|
578
|
+
config.framework = :rails
|
|
579
|
+
|
|
580
|
+
# Notifications with Mario theme
|
|
581
|
+
config.notifications = :terminal_notifier
|
|
582
|
+
config.mode = :mario_bros
|
|
583
|
+
|
|
584
|
+
# Performance settings
|
|
585
|
+
config.observer = :listen
|
|
586
|
+
config.just_watch = false
|
|
587
|
+
config.verbose = true
|
|
588
|
+
|
|
589
|
+
# Ignore slow tests during development
|
|
590
|
+
config.ignore_test_folders = ['spec/system']
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
# Clear screen before each run
|
|
594
|
+
InfinityTest::Core::Base.before(:all) do
|
|
595
|
+
InfinityTest::Core::Base.clear_terminal
|
|
596
|
+
end
|
|
597
|
+
|
|
598
|
+
# Notify via system sound when done
|
|
599
|
+
InfinityTest::Core::Base.after(:all) do
|
|
600
|
+
system('afplay /System/Library/Sounds/Glass.aiff')
|
|
601
|
+
end
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## Contributing
|
|
607
|
+
|
|
608
|
+
1. Fork the repository
|
|
609
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
610
|
+
3. Run the tests (`infinity_test`)
|
|
611
|
+
4. Commit your changes (`git commit -am 'Add amazing feature'`)
|
|
612
|
+
5. Push to the branch (`git push origin feature/amazing-feature`)
|
|
613
|
+
6. Create a Pull Request
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## License
|
|
618
|
+
|
|
619
|
+
MIT License - see [LICENSE.txt](LICENSE.txt) for details.
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
## Author
|
|
624
|
+
|
|
625
|
+
Tomas D'Stefano
|
|
626
|
+
|
|
627
|
+
**Happy Testing!**
|
data/Rakefile
CHANGED
|
@@ -1,65 +1 @@
|
|
|
1
|
-
|
|
2
|
-
require 'rubygems'
|
|
3
|
-
require 'rake'
|
|
4
|
-
|
|
5
|
-
require 'rake/clean'
|
|
6
|
-
CLEAN.include('lib/*rbc','lib/*/*.rbc', 'spec/*.rbc', 'spec/*/*.rbc', 'lib/*/*/*rbc', 'spec/*/*/*rbc')
|
|
7
|
-
|
|
8
|
-
task :clean_without_verbose do
|
|
9
|
-
verbose(false)
|
|
10
|
-
Rake::Task['clean'].invoke
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
$:.unshift(File.dirname(__FILE__) + '/lib')
|
|
14
|
-
|
|
15
|
-
POST_MESSAGE = <<-POST_INSTALL_MESSAGE
|
|
16
|
-
|
|
17
|
-
#{ '-' * 80}
|
|
18
|
-
T O I N F I N I T Y A N D B E Y O N D !!!
|
|
19
|
-
|
|
20
|
-
The Infinity uses the awesome RVM to run.
|
|
21
|
-
If you don't have the RVM installed, stop what you doing =p.
|
|
22
|
-
RVM Installation Instructions:
|
|
23
|
-
http://rvm.beginrescueend.com/rvm/install/
|
|
24
|
-
And don't forget to see how you can customize Infinity Test here:
|
|
25
|
-
http://github.com/tomas-stefano/infinity_test/wiki/Customize-Infinity-Test
|
|
26
|
-
|
|
27
|
-
Happy Coding! :)
|
|
28
|
-
|
|
29
|
-
#{ '-' * 80}
|
|
30
|
-
|
|
31
|
-
POST_INSTALL_MESSAGE
|
|
32
|
-
|
|
33
|
-
begin
|
|
34
|
-
require 'jeweler'
|
|
35
|
-
Jeweler::Tasks.new do |gemspec|
|
|
36
|
-
gemspec.name = "infinity_test"
|
|
37
|
-
gemspec.summary = "Continuous testing and a flexible alternative to Autotest using watchr and RVM"
|
|
38
|
-
gemspec.description = "Infinity Test is a continuous testing library and a flexible alternative to Autotest, using Watchr library with Rspec, Test::Unit or Bacon with RVM funcionality, giving the possibility to test with all Rubies that you have in your RVM configuration."
|
|
39
|
-
gemspec.email = "tomasdestefi@gmail.com"
|
|
40
|
-
gemspec.homepage = "http://github.com/tomas-stefano/infinity_test"
|
|
41
|
-
gemspec.authors = ["Tomas D'Stefano"]
|
|
42
|
-
|
|
43
|
-
gemspec.add_dependency('watchr', '>= 0.7')
|
|
44
|
-
gemspec.add_dependency('notifiers', '>= 1.1.0')
|
|
45
|
-
|
|
46
|
-
gemspec.add_development_dependency('rspec', '>= 2.0.1')
|
|
47
|
-
gemspec.add_development_dependency('jeweler', '>= 1.4.0')
|
|
48
|
-
|
|
49
|
-
gemspec.post_install_message = POST_MESSAGE
|
|
50
|
-
end
|
|
51
|
-
Jeweler::GemcutterTasks.new
|
|
52
|
-
rescue LoadError
|
|
53
|
-
puts("-" * 80)
|
|
54
|
-
puts "Jeweler not available. Install it with:
|
|
55
|
-
[sudo] gem install jeweler"
|
|
56
|
-
puts("-" * 80)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
require 'rspec/core/rake_task'
|
|
61
|
-
RSpec::Core::RakeTask.new("spec") do |t|
|
|
62
|
-
t.pattern = "./spec/infinity_test/**/*_spec.rb"
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
task :default => :spec
|
|
1
|
+
require 'bundler/gem_tasks'
|