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.markdown
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
# Infinity Test
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Infinity Test is a continuous testing library and a flexible alternative to Autotest,
|
|
5
|
-
using the awesome Watchr library with Rspec, Test::Unit, Bacon and with RVM funcionality,
|
|
6
|
-
giving the possibility to test with all <b>Rubies</b> that you have in your RVM configuration.
|
|
7
|
-
|
|
8
|
-
## To Infinity and Beyond!
|
|
9
|
-
|
|
10
|
-
<div style="padding:2px; border:1px solid silver; float:right; margin:0 0 1em 2em; background:white">
|
|
11
|
-
<img src="http://github.com/tomas-stefano/infinity_test/raw/master/buzz_images/to_infinity_and_beyond.png" alt="Infinity Test" />
|
|
12
|
-
<p style="text-align:center"> Photo taken by <a href="http://www.mixed-metaphor.org/fan/buzz/" title="buzz-light-year"> this site </a></p>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
## Install
|
|
16
|
-
|
|
17
|
-
gem install infinity_test
|
|
18
|
-
|
|
19
|
-
## Running Tests only in one ruby
|
|
20
|
-
|
|
21
|
-
With Rspec:
|
|
22
|
-
|
|
23
|
-
infinity_test --rspec
|
|
24
|
-
|
|
25
|
-
With Test::Unit:
|
|
26
|
-
|
|
27
|
-
infinity_test --test-unit
|
|
28
|
-
|
|
29
|
-
With Bacon:
|
|
30
|
-
|
|
31
|
-
infinity_test --bacon
|
|
32
|
-
|
|
33
|
-
## Running Tests with many Rubies
|
|
34
|
-
|
|
35
|
-
With Rspec:
|
|
36
|
-
|
|
37
|
-
infinity_test --rspec --rubies=1.8.7,jruby,1.9.2,ree
|
|
38
|
-
|
|
39
|
-
Or with Test::Unit:
|
|
40
|
-
|
|
41
|
-
infinity_test --test-unit --rubies=1.8.7,jruby,ree,1.9.2
|
|
42
|
-
|
|
43
|
-
Or with bacon:
|
|
44
|
-
|
|
45
|
-
infinity_test --bacon --rubies=1.8.7,ree,1.9.2
|
|
46
|
-
|
|
47
|
-
<b>And you are ready to Test with all ruby versions your Rspec or Test::Unit Suite with Autotest-like Behavior.</b>
|
|
48
|
-
|
|
49
|
-
## Running Tests with Rails (only in master branch!)
|
|
50
|
-
|
|
51
|
-
With Rails:
|
|
52
|
-
|
|
53
|
-
infinity_test --rails
|
|
54
|
-
|
|
55
|
-
## Configuration file
|
|
56
|
-
|
|
57
|
-
### Simple Domain Specific Language for Infinity Test file
|
|
58
|
-
|
|
59
|
-
If you don't set all the time the rubies that you want, test framework that you want, notifications that you want,
|
|
60
|
-
you can write some code that infinity_test understand.
|
|
61
|
-
|
|
62
|
-
So create the global file or project file called:
|
|
63
|
-
|
|
64
|
-
~/.infinity_test or .infinity_test
|
|
65
|
-
|
|
66
|
-
infinity_test do
|
|
67
|
-
|
|
68
|
-
notifications :growl do
|
|
69
|
-
show_images :mode => :mario_bros
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
use :rubies => %w(1.9.1 jruby 1.9.2 ree), :test_framework => :rspec
|
|
73
|
-
|
|
74
|
-
before(:each_ruby) do |environment|
|
|
75
|
-
# ...
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
after(:each_ruby) do |environment|
|
|
79
|
-
# ...
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
before_run do
|
|
83
|
-
clear :terminal
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
after_run do
|
|
87
|
-
# ...
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
heuristics('my_pattern') do |file|
|
|
91
|
-
# ...
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
replace_patterns do |application|
|
|
95
|
-
# ...
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
## Customize the .infinity_test file
|
|
101
|
-
|
|
102
|
-
#### If you want to customize and understand the .infinity_test file, <a href='http://github.com/tomas-stefano/infinity_test/wiki/Customize-Infinity-Test'>Read this Page</a>
|
|
103
|
-
|
|
104
|
-
# Color in RSpec
|
|
105
|
-
|
|
106
|
-
### Put this in your <b>.rspec</b> file:
|
|
107
|
-
|
|
108
|
-
--color
|
|
109
|
-
--autotest
|
|
110
|
-
|
|
111
|
-
## You Like it the Idea?
|
|
112
|
-
|
|
113
|
-
<b>So make a fork and start contributing =].</b>
|
|
114
|
-
|
|
115
|
-
## You have a Feature request or Fix?
|
|
116
|
-
|
|
117
|
-
<b>Contact me in Github and let's talk! =] </b>
|
|
118
|
-
|
|
119
|
-
# Acknowledgments
|
|
120
|
-
|
|
121
|
-
* Thanks to Mynyml and Watchr library.
|
|
122
|
-
* Thanks to Waynee Seguin and the RVM.
|
data/Tasks
DELETED
data/VERSION.yml
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/features/heuristics.feature
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
Feature: Infinity test Heuristics
|
|
2
|
-
In order to add or remove the paths to monitoring
|
|
3
|
-
As a user
|
|
4
|
-
I want to add/remove my own patterns to monitoring changes
|
|
5
|
-
|
|
6
|
-
Scenario: Show the default patterns to RubyGems
|
|
7
|
-
When I run "ruby ../../bin/infinity_test --heuristics --rubygems --rspec"
|
|
8
|
-
Then the output should contain:
|
|
9
|
-
"""
|
|
10
|
-
- "^lib/*/(.*).rb"
|
|
11
|
-
- "^spec/*/(.*)_spec.rb"
|
|
12
|
-
- "^spec/*/spec_helper.rb"
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
Scenario: Show the default patterns to RubyGems
|
|
16
|
-
When I run "ruby ../../bin/infinity_test --heuristics --rubygems --test-unit"
|
|
17
|
-
Then the output should contain:
|
|
18
|
-
"""
|
|
19
|
-
- "^lib/*/(.*).rb"
|
|
20
|
-
- "^test/*/(.*)_test.rb"
|
|
21
|
-
- "^test/*/test_helper.rb"
|
|
22
|
-
"""
|
|
23
|
-
|
data/features/support/env.rb
DELETED
data/images/fuuu/sucess.png
DELETED
|
Binary file
|
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
class Application
|
|
3
|
-
include InfinityTest::TestLibrary
|
|
4
|
-
include InfinityTest::ApplicationLibrary
|
|
5
|
-
include Notifiers
|
|
6
|
-
|
|
7
|
-
attr_accessor :config, :watchr, :global_commands
|
|
8
|
-
|
|
9
|
-
# Initialize the Application object with the configuration instance to
|
|
10
|
-
# load configuration and set properly
|
|
11
|
-
#
|
|
12
|
-
def initialize
|
|
13
|
-
@config = InfinityTest.configuration
|
|
14
|
-
@watchr = InfinityTest.watchr
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def load_configuration_file_or_read_the_options!(options)
|
|
18
|
-
load_configuration_file
|
|
19
|
-
setup!(options)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Load the Configuration file
|
|
23
|
-
#
|
|
24
|
-
# Command line options can be persisted in a .infinity_test file in a project.
|
|
25
|
-
# You can also store a .infinity_test file in your home directory (~/.infinity_test) with global options.
|
|
26
|
-
#
|
|
27
|
-
# Precedence is:
|
|
28
|
-
# command line
|
|
29
|
-
# ./.infinity_test
|
|
30
|
-
# ~/.infinity_test
|
|
31
|
-
#
|
|
32
|
-
# Example:
|
|
33
|
-
#
|
|
34
|
-
# ~/.infinity_test -> infinity_test { notifications :growl }
|
|
35
|
-
#
|
|
36
|
-
# ./.infinity_test -> infinity_test { notifications :lib_notify } # High Priority
|
|
37
|
-
#
|
|
38
|
-
# After the load the Notifications Framework will be Lib Notify
|
|
39
|
-
#
|
|
40
|
-
def load_configuration_file
|
|
41
|
-
load_global_configuration # Separate global and local configuration
|
|
42
|
-
load_project_configuration # because it's more easy to test
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# Setup over a precendence show below.
|
|
46
|
-
#
|
|
47
|
-
# THIS IS NOT RESPONSABILITY OF Application instances!!!
|
|
48
|
-
#
|
|
49
|
-
def setup!(options)
|
|
50
|
-
config.use(
|
|
51
|
-
:rubies => (options[:rubies] || rubies),
|
|
52
|
-
:test_framework => (options[:test_framework] || config.test_framework),
|
|
53
|
-
:app_framework => (options[:app_framework] || config.app_framework),
|
|
54
|
-
:cucumber => options[:cucumber],
|
|
55
|
-
:verbose => options[:verbose] || config.verbose)
|
|
56
|
-
config.skip_bundler! if options[:skip_bundler?]
|
|
57
|
-
add_heuristics!
|
|
58
|
-
heuristics_users_high_priority!
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# Run the global commands
|
|
62
|
-
#
|
|
63
|
-
def run_global_commands!
|
|
64
|
-
run!(global_commands)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
# Construct the Global Commands and cache for all suite
|
|
68
|
-
#
|
|
69
|
-
def global_commands
|
|
70
|
-
@global_commands ||= construct_commands
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
# Return the sucess image to show in the notifications
|
|
74
|
-
#
|
|
75
|
-
def sucess_image
|
|
76
|
-
config.sucess_image
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
# Return the failure image to show in the notifications
|
|
80
|
-
#
|
|
81
|
-
def failure_image
|
|
82
|
-
config.failure_image
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
# Return the pending image to show in the notifications
|
|
86
|
-
#
|
|
87
|
-
def pending_image
|
|
88
|
-
config.pending_image
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# Return the block object setting in the config file
|
|
92
|
-
#
|
|
93
|
-
def before_callback
|
|
94
|
-
config.before_callback
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
# Return the block object setting in the config file
|
|
98
|
-
#
|
|
99
|
-
def after_callback
|
|
100
|
-
config.after_callback
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
# Return the block object setting in the before(:each_ruby) block
|
|
104
|
-
#
|
|
105
|
-
def before_each_ruby_callback
|
|
106
|
-
config.before_each_ruby_callback
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
# Return the block object setting in the after(:each_ruby) block
|
|
110
|
-
#
|
|
111
|
-
def after_each_ruby_callback
|
|
112
|
-
config.after_each_ruby_callback
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
# Return the rubies setting in the config file or the command line
|
|
116
|
-
#
|
|
117
|
-
def rubies
|
|
118
|
-
config.rubies
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
# Return true if verbose mode is on
|
|
122
|
-
# Verbose mode is false as default
|
|
123
|
-
#
|
|
124
|
-
def verbose?
|
|
125
|
-
config.verbose
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
# Return true if the user application has a Gemfile
|
|
129
|
-
# Return false if not exist the Gemfile
|
|
130
|
-
#
|
|
131
|
-
def have_gemfile?
|
|
132
|
-
File.exist?(gemfile)
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
# Return false if you want the InfinityTest run with bundler
|
|
136
|
-
# Return true otherwise
|
|
137
|
-
#
|
|
138
|
-
def skip_bundler?
|
|
139
|
-
config.skip_bundler?
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
# Contruct all the commands for the test framework
|
|
143
|
-
#
|
|
144
|
-
def construct_commands
|
|
145
|
-
test_framework.construct_commands
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
# Return a instance of the test framework class
|
|
149
|
-
#
|
|
150
|
-
def test_framework
|
|
151
|
-
@test_framework ||= setting_test_framework
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
# Return true if the application is using Test::Unit
|
|
155
|
-
# Return false otherwise
|
|
156
|
-
#
|
|
157
|
-
def using_test_unit?
|
|
158
|
-
test_framework.instance_of?(TestUnit)
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
# Return a instance of the app framework class
|
|
162
|
-
#
|
|
163
|
-
def app_framework
|
|
164
|
-
@app_framework ||= setting_app_framework
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
# Return all the Heuristics of the application
|
|
168
|
-
#
|
|
169
|
-
def heuristics
|
|
170
|
-
config.instance_variable_get(:@heuristics)
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
# Triggers the #add_heuristics! method in the application_framework
|
|
174
|
-
#
|
|
175
|
-
def add_heuristics!
|
|
176
|
-
app_framework.add_heuristics!
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
def heuristics_users_high_priority!
|
|
180
|
-
@watchr.rules.reverse!
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
# Pass many commands(expecting something that talk like Hash) and run them
|
|
184
|
-
# First, triggers all the before each callbacks, run the commands
|
|
185
|
-
# and last, triggers after each callbacks
|
|
186
|
-
#
|
|
187
|
-
def run!(commands)
|
|
188
|
-
before_callback.call if before_callback
|
|
189
|
-
|
|
190
|
-
commands.each do |ruby_version, command|
|
|
191
|
-
call_each_ruby_callback(:before_each_ruby_callback, ruby_version)
|
|
192
|
-
command = say_the_ruby_version_and_run_the_command!(ruby_version, command) # This method exist because it's more easier to test
|
|
193
|
-
notify!(:results => command.results, :ruby_version => ruby_version)
|
|
194
|
-
call_each_ruby_callback(:after_each_ruby_callback, ruby_version)
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
after_callback.call if after_callback
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
# Return the notification_framework setting in the configuration file
|
|
201
|
-
# Maybe is: :growl, :lib_notify
|
|
202
|
-
#
|
|
203
|
-
def notification_framework
|
|
204
|
-
config.notification_framework
|
|
205
|
-
end
|
|
206
|
-
|
|
207
|
-
# Send the message,image and the actual ruby version to show in the notification system
|
|
208
|
-
#
|
|
209
|
-
def notify!(options)
|
|
210
|
-
if notification_framework
|
|
211
|
-
message = parse_results(options[:results])
|
|
212
|
-
title = options[:ruby_version]
|
|
213
|
-
send(notification_framework).title(title).message(message).image(image_to_show).notify!
|
|
214
|
-
else
|
|
215
|
-
# skip(do nothing) when not have notification framework
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
# Parse the results for each command to the test framework
|
|
220
|
-
#
|
|
221
|
-
# app.parse_results(['.....','108 examples']) # => '108 examples'
|
|
222
|
-
#
|
|
223
|
-
def parse_results(results)
|
|
224
|
-
test_framework.parse_results(results)
|
|
225
|
-
end
|
|
226
|
-
|
|
227
|
-
# If the test pass, show the sucess image
|
|
228
|
-
# If is some pending test, show the pending image
|
|
229
|
-
# If the test fails, show the failure image
|
|
230
|
-
#
|
|
231
|
-
def image_to_show
|
|
232
|
-
if test_framework.failure?
|
|
233
|
-
failure_image
|
|
234
|
-
elsif test_framework.pending?
|
|
235
|
-
pending_image
|
|
236
|
-
else
|
|
237
|
-
sucess_image
|
|
238
|
-
end
|
|
239
|
-
end
|
|
240
|
-
|
|
241
|
-
# Return the files that match by the options
|
|
242
|
-
# This very used in the #run method called in the heuristics instances
|
|
243
|
-
#
|
|
244
|
-
# Example:
|
|
245
|
-
#
|
|
246
|
-
# files_to_run!(:all => :files) # => Return all test files
|
|
247
|
-
# files_to_run!(:all => :files, :in_dir => :models) # => Return all the test files in the models directory
|
|
248
|
-
# files_to_run!(:test_for => match_data) # => Return the tests that match with the MatchData Object
|
|
249
|
-
# files_to_run!(:test_for => match_data, :in_dir => :controllers) # => Return the tests that match with the MatchData Object
|
|
250
|
-
# files_to_run!(match_data) # => return the test file
|
|
251
|
-
#
|
|
252
|
-
def files_to_run!(options)
|
|
253
|
-
files = search_files_to_run!(options)
|
|
254
|
-
# Fix fo Test::Unit - But this is not responsability of the Application instances - Refactoring this
|
|
255
|
-
files = "#{test_framework.test_loader} #{files}" if test_framework.respond_to?(:test_loader)
|
|
256
|
-
files
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
def search_files_to_run!(options)
|
|
260
|
-
case options
|
|
261
|
-
when MatchData
|
|
262
|
-
options.to_s
|
|
263
|
-
when Hash,Symbol
|
|
264
|
-
if options.equal?(:all) or options.include?(:all)
|
|
265
|
-
search_files_in_dir(all_test_files, :in_dir => options[:in_dir]).join(' ')
|
|
266
|
-
else
|
|
267
|
-
search_file(:pattern => options[:test_for][1], :in_dir => options[:in_dir]) if options.include?(:test_for)
|
|
268
|
-
end
|
|
269
|
-
end
|
|
270
|
-
end
|
|
271
|
-
|
|
272
|
-
# Search files under the dir(s) specified
|
|
273
|
-
#
|
|
274
|
-
def search_files_in_dir(files, options)
|
|
275
|
-
dirs = [options[:in_dir]].compact.flatten
|
|
276
|
-
match_files = dirs.collect do |directory|
|
|
277
|
-
files.select { |file| file.match(directory.to_s) }
|
|
278
|
-
end
|
|
279
|
-
match_files.empty? ? files : match_files
|
|
280
|
-
end
|
|
281
|
-
|
|
282
|
-
# Search files that matches with the pattern
|
|
283
|
-
#
|
|
284
|
-
def search_file(options)
|
|
285
|
-
files = all_test_files.grep(/#{options[:pattern]}/i)
|
|
286
|
-
search_files_in_dir(files, :in_dir => options[:in_dir]).join(' ')
|
|
287
|
-
end
|
|
288
|
-
|
|
289
|
-
# Return all the tests files in the User application
|
|
290
|
-
#
|
|
291
|
-
def all_test_files
|
|
292
|
-
test_framework.all_files
|
|
293
|
-
end
|
|
294
|
-
|
|
295
|
-
# Run commands for a file
|
|
296
|
-
# If dont have a file, do nothing
|
|
297
|
-
#
|
|
298
|
-
def run_commands_for_file(file)
|
|
299
|
-
if file and !file.empty?
|
|
300
|
-
commands = test_framework.construct_commands(file)
|
|
301
|
-
run!(commands)
|
|
302
|
-
end
|
|
303
|
-
end
|
|
304
|
-
|
|
305
|
-
def say_the_ruby_version_and_run_the_command!(ruby_version, command)
|
|
306
|
-
puts; puts "* { :ruby => #{ruby_version} }"
|
|
307
|
-
puts command if verbose?
|
|
308
|
-
Command.new(:ruby_version => ruby_version, :command => command).run!
|
|
309
|
-
end
|
|
310
|
-
|
|
311
|
-
private
|
|
312
|
-
|
|
313
|
-
def call_each_ruby_callback(callback_type, ruby_version)
|
|
314
|
-
callback = send(callback_type)
|
|
315
|
-
callback.call(RVM::Environment.new(ruby_version)) if callback
|
|
316
|
-
end
|
|
317
|
-
|
|
318
|
-
def setting_test_framework
|
|
319
|
-
case config.test_framework
|
|
320
|
-
when :rspec
|
|
321
|
-
Rspec.new :rubies => rubies
|
|
322
|
-
when :test_unit
|
|
323
|
-
TestUnit.new :rubies => rubies
|
|
324
|
-
when :bacon
|
|
325
|
-
Bacon.new :rubies => rubies
|
|
326
|
-
end
|
|
327
|
-
end
|
|
328
|
-
|
|
329
|
-
def setting_app_framework
|
|
330
|
-
case config.app_framework
|
|
331
|
-
when :rails
|
|
332
|
-
Rails.new
|
|
333
|
-
when :rubygems
|
|
334
|
-
RubyGems.new
|
|
335
|
-
end
|
|
336
|
-
end
|
|
337
|
-
|
|
338
|
-
def load_global_configuration
|
|
339
|
-
load_file(File.expand_path('~/.infinity_test'))
|
|
340
|
-
end
|
|
341
|
-
|
|
342
|
-
def load_project_configuration
|
|
343
|
-
load_file('./.infinity_test')
|
|
344
|
-
end
|
|
345
|
-
|
|
346
|
-
def load_file(file)
|
|
347
|
-
load(file) if File.exist?(file)
|
|
348
|
-
end
|
|
349
|
-
|
|
350
|
-
def gemfile
|
|
351
|
-
File.join(Dir.pwd, 'Gemfile')
|
|
352
|
-
end
|
|
353
|
-
|
|
354
|
-
end
|
|
355
|
-
end
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
module ApplicationLibrary
|
|
3
|
-
class Rails
|
|
4
|
-
include HeuristicsHelper
|
|
5
|
-
attr_accessor :lib_pattern,
|
|
6
|
-
:test_pattern,
|
|
7
|
-
:configuration_pattern,
|
|
8
|
-
:routes_pattern,
|
|
9
|
-
:fixtures_pattern,
|
|
10
|
-
:controllers_pattern,
|
|
11
|
-
:models_pattern,
|
|
12
|
-
:helpers_pattern,
|
|
13
|
-
:mailers_pattern,
|
|
14
|
-
:application_controller_pattern,
|
|
15
|
-
:application_helper_pattern
|
|
16
|
-
|
|
17
|
-
def initialize
|
|
18
|
-
@application = InfinityTest.application
|
|
19
|
-
resolve_patterns!
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def add_heuristics!
|
|
23
|
-
rails = self
|
|
24
|
-
heuristics do
|
|
25
|
-
|
|
26
|
-
add(rails.application_controller_pattern) do |file|
|
|
27
|
-
run :all => :tests, :in_dir => :controllers
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
add(rails.application_helper_pattern) do |file|
|
|
31
|
-
run :all => :tests, :in_dir => [:helpers, :views]
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
add(rails.configuration_pattern) do |file|
|
|
35
|
-
run(:all => :tests)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
add(rails.routes_pattern) do |file|
|
|
39
|
-
run(:all => :tests)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
add(rails.controllers_pattern) do |file|
|
|
43
|
-
run :test_for => file, :in_dir => :controllers
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
add(rails.models_pattern) do |file|
|
|
47
|
-
run :test_for => file, :in_dir => :models
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
add(rails.helpers_pattern) do |file|
|
|
51
|
-
run :test_for => file, :in_dir => :helpers
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
add(rails.mailers_pattern) do |file|
|
|
55
|
-
run :test_for => file, :in_dir => :mailers
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
add(rails.lib_pattern) do |file|
|
|
59
|
-
run :test_for => file, :in_dir => :lib
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
add(rails.test_pattern) do |file|
|
|
63
|
-
run file
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
add(rails.fixtures_pattern) do |file|
|
|
67
|
-
run :all => :tests, :in_dir => :models
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def resolve_patterns!
|
|
74
|
-
@configuration_pattern = "^config/application.rb"
|
|
75
|
-
@routes_pattern = "^config/routes\.rb"
|
|
76
|
-
@lib_pattern = "^lib/*/(.*)\.rb"
|
|
77
|
-
if @application.using_test_unit?
|
|
78
|
-
@test_pattern = "^test/*/(.*)_test.rb"
|
|
79
|
-
@fixtures_pattern = "^test/fixtures/(.*).yml"
|
|
80
|
-
else
|
|
81
|
-
@test_pattern = "^spec/*/(.*)_spec.rb"
|
|
82
|
-
@fixtures_pattern = "^spec/fixtures/(.*).yml"
|
|
83
|
-
end
|
|
84
|
-
@controllers_pattern = "^app/controllers/(.*)\.rb"
|
|
85
|
-
@models_pattern = "^app/models/(.*)\.rb"
|
|
86
|
-
@helpers_pattern = "^app/helpers/(.*)\.rb"
|
|
87
|
-
@mailers_pattern = "^app/mailers/(.*)\.rb"
|
|
88
|
-
@application_controller_pattern = "^app/controllers/application_controller.rb"
|
|
89
|
-
@application_helper_pattern = "^app/helpers/application_helper.rb"
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
module ApplicationLibrary
|
|
3
|
-
class RubyGems
|
|
4
|
-
include HeuristicsHelper
|
|
5
|
-
attr_accessor :lib_pattern, :test_pattern, :application, :test_helper_pattern
|
|
6
|
-
|
|
7
|
-
def initialize
|
|
8
|
-
@application = InfinityTest.application
|
|
9
|
-
@lib_pattern = "^lib/*/(.*)\.rb"
|
|
10
|
-
if @application.using_test_unit?
|
|
11
|
-
@test_pattern = "^test/*/(.*)_test.rb"
|
|
12
|
-
@test_helper_pattern = "^test/*/test_helper.rb"
|
|
13
|
-
else
|
|
14
|
-
@test_pattern = "^spec/*/(.*)_spec.rb"
|
|
15
|
-
@test_helper_pattern = "^spec/*/spec_helper.rb"
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Add Heuristics to send to Watchr Methods
|
|
20
|
-
# This methods aren't tested!
|
|
21
|
-
#
|
|
22
|
-
def add_heuristics!
|
|
23
|
-
rubygems = self
|
|
24
|
-
heuristics do
|
|
25
|
-
|
|
26
|
-
add(rubygems.lib_pattern) do |file|
|
|
27
|
-
run :test_for => file
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
add(rubygems.test_pattern) do |file|
|
|
31
|
-
run file
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
add(rubygems.test_helper_pattern) do |file|
|
|
35
|
-
run :all => :tests
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
module BinaryPath
|
|
3
|
-
|
|
4
|
-
def self.included(base)
|
|
5
|
-
base.extend ClassMethods
|
|
6
|
-
base.send :include, ClassMethods
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def rvm_bin_path(environment, binary)
|
|
10
|
-
environment.path_for(binary)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def print_message(gem_name, ruby_version)
|
|
14
|
-
puts "\n Ruby => #{ruby_version}: I searched the #{gem_name} binary path and I don't find nothing. You have the #{gem_name} installed in this version?"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def search_binary(binary_name, options)
|
|
18
|
-
rvm_bin_path(options[:environment], binary_name)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def have_binary?(binary)
|
|
22
|
-
File.exist?(binary)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
module ClassMethods
|
|
26
|
-
|
|
27
|
-
# Set the binary to search in the RVM binary folder
|
|
28
|
-
#
|
|
29
|
-
# binary :bundle
|
|
30
|
-
#
|
|
31
|
-
def binary(binary_name, options={})
|
|
32
|
-
method_sufix = options[:name] || binary_name
|
|
33
|
-
eval <<-EVAL
|
|
34
|
-
def search_#{method_sufix}(environment)
|
|
35
|
-
search_binary('#{binary_name}', :environment => environment)
|
|
36
|
-
end
|
|
37
|
-
EVAL
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
|
43
|
-
end
|