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
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module InfinityTest
|
|
4
|
-
describe Configuration do
|
|
5
|
-
before { @config = Configuration.new }
|
|
6
|
-
let(:config) { @config }
|
|
7
|
-
let(:block) { Proc.new { 'To Infinity and beyond!' } }
|
|
8
|
-
|
|
9
|
-
describe '#initialize' do
|
|
10
|
-
|
|
11
|
-
it "should set the test_unit as default test framework" do
|
|
12
|
-
Configuration.new.test_framework.should equal :test_unit
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe '#heuristics' do
|
|
18
|
-
|
|
19
|
-
it "should return a instance of Heuristics class" do
|
|
20
|
-
config.heuristics do
|
|
21
|
-
end.should be_instance_of(InfinityTest::Heuristics)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "should be possible to add heuristics to the application" do
|
|
25
|
-
heuristics = config.heuristics do
|
|
26
|
-
add("^lib/*/(.*)\.rb") do |file|
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
heuristics.should have_pattern("^lib/*/(.*)\.rb")
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it "should cache the heuristics instance variable" do
|
|
33
|
-
heuristics = config.heuristics do
|
|
34
|
-
end
|
|
35
|
-
same_heuristics = config.heuristics do
|
|
36
|
-
end
|
|
37
|
-
heuristics.should equal same_heuristics
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
describe '#watch' do
|
|
42
|
-
|
|
43
|
-
it "should evaluate in the watchr script class" do
|
|
44
|
-
config.watch("^lib/*/(.*)\.rb") do |file|
|
|
45
|
-
do_something!
|
|
46
|
-
end.should equal InfinityTest.watchr
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
describe '#notifications' do
|
|
52
|
-
|
|
53
|
-
it "should possible to set the growl notification framework" do
|
|
54
|
-
config.notifications :growl
|
|
55
|
-
config.notification_framework.should equal :growl
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it "should possible to set the lib notify notification framework" do
|
|
59
|
-
config.notifications :lib_notify
|
|
60
|
-
config.notification_framework.should equal :lib_notify
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
it "should not possible to set another notification framework" do
|
|
64
|
-
lambda { config.notifications(:dont_exist) }.should raise_exception(NotificationFrameworkDontSupported, "Notification :dont_exist don't supported. The Frameworks supported are: growl,lib_notify")
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it "should raise exception for non supported notification framework" do
|
|
68
|
-
lambda { config.notifications(:snarfff) }.should raise_exception(NotificationFrameworkDontSupported, "Notification :snarfff don't supported. The Frameworks supported are: growl,lib_notify")
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
describe '#use' do
|
|
74
|
-
|
|
75
|
-
it "should set the rvm versions" do
|
|
76
|
-
config.use :rubies => '1.8.7-p249'
|
|
77
|
-
config.rubies.should be == '1.8.7-p249'
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "should set many ruby versions" do
|
|
81
|
-
config.use :rubies => ['1.9.1', '1.9.2']
|
|
82
|
-
config.rubies.should be == '1.9.1,1.9.2'
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
it "should set the gemset and change all rubies" do
|
|
86
|
-
config.use :rubies => ['1.9.1', '1.9.2'], :gemset => 'infinity_test'
|
|
87
|
-
config.rubies.should be == '1.9.1@infinity_test,1.9.2@infinity_test'
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
it "should set the gemset and change all rubies" do
|
|
91
|
-
config.use :rubies => ['1.9.1', '1.9.2'], :gemset => 'other_gemset'
|
|
92
|
-
config.rubies.should be == '1.9.1@other_gemset,1.9.2@other_gemset'
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
it "should set many ruby versions with nil gemset key" do
|
|
96
|
-
config.use :rubies => ['1.9.1', '1.9.2'], :gemset => nil
|
|
97
|
-
config.rubies.should be == '1.9.1,1.9.2'
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
it "should set the test unit when not set the test framework" do
|
|
101
|
-
config.use
|
|
102
|
-
config.test_framework.should equal :test_unit
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
it "should return the test framework" do
|
|
106
|
-
config.use :test_framework => :rspec
|
|
107
|
-
config.test_framework.should equal :rspec
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it "should return bacon too for the test framework" do
|
|
111
|
-
config.use :test_framework => :bacon
|
|
112
|
-
config.test_framework.should equal :bacon
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
it "should possible to set the test unit for test framework" do
|
|
116
|
-
config.use :test_framework => :test_unit
|
|
117
|
-
config.test_framework.should equal :test_unit
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
it "should set the verbose option" do
|
|
121
|
-
config.use :verbose => true
|
|
122
|
-
config.verbose.should be_true
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
it "should set to false as default" do
|
|
126
|
-
config.verbose.should equal false
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
it "should be possible to use Rails framework" do
|
|
130
|
-
config.use :app_framework => :rails
|
|
131
|
-
config.app_framework.should equal :rails
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
it "should set the rubygems as default app framework" do
|
|
135
|
-
config.use
|
|
136
|
-
config.app_framework.should equal :rubygems
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
it "should be possible to set the cucumber option" do
|
|
140
|
-
config.use :cucumber => true
|
|
141
|
-
config.cucumber?.should be_true
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
it "should be false as default" do
|
|
145
|
-
config.cucumber?.should be_false
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
it "should return false if cucumber is nil in #use method" do
|
|
149
|
-
config.use :cucumber => nil
|
|
150
|
-
config.cucumber?.should be_false
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
describe '#skip_bundler!' do
|
|
156
|
-
|
|
157
|
-
it "should return true if skip bundler" do
|
|
158
|
-
config.skip_bundler!
|
|
159
|
-
config.skip_bundler?.should be_true
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
it "should return false if not skip bundler (default)" do
|
|
163
|
-
config.skip_bundler?.should be_false
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
describe '#ignore' do
|
|
169
|
-
|
|
170
|
-
it "should be empty when not have dir/files to ignore" do
|
|
171
|
-
config.ignore
|
|
172
|
-
config.exceptions_to_ignore.should be == []
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
it "should set the exception to ignore" do
|
|
176
|
-
config.ignore :exceptions => %w(.svn)
|
|
177
|
-
config.exceptions_to_ignore.should be == %w(.svn)
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
it "should set the exceptions to ignore changes" do
|
|
181
|
-
config.ignore :exceptions => %w(.svn .hg .git vendor tmp config rerun.txt)
|
|
182
|
-
config.exceptions_to_ignore.should be == %w(.svn .hg .git vendor tmp config rerun.txt)
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
describe '#show_images' do
|
|
188
|
-
|
|
189
|
-
before { @config = Configuration.new }
|
|
190
|
-
|
|
191
|
-
let(:config) { @config }
|
|
192
|
-
|
|
193
|
-
context 'on default images' do
|
|
194
|
-
before { @config.notifications :growl }
|
|
195
|
-
|
|
196
|
-
it { config.sucess_image.should == image('simpson/sucess.jpg') }
|
|
197
|
-
|
|
198
|
-
it { config.pending_image.should == image('simpson/pending.jpg') }
|
|
199
|
-
|
|
200
|
-
it { config.failure_image.should == image('simpson/failure.gif') }
|
|
201
|
-
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
context 'on setting my own image' do
|
|
205
|
-
before { config.notifications :lib_notify }
|
|
206
|
-
|
|
207
|
-
it "should be possible to customize success image" do
|
|
208
|
-
config.show_images :sucess => image('other.png')
|
|
209
|
-
config.sucess_image.should == image('other.png')
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
it "should be possible to customize failure image" do
|
|
213
|
-
config.show_images :failure => image('failure_picture.png')
|
|
214
|
-
config.failure_image.should == image('failure_picture.png')
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
it "should be possible to customize failure image" do
|
|
218
|
-
config.show_images :pending => image('pending_picture.png')
|
|
219
|
-
config.pending_image.should == image('pending_picture.png')
|
|
220
|
-
end
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
context 'setting the dirrectory image or modes' do
|
|
224
|
-
before { config.notifications :growl }
|
|
225
|
-
|
|
226
|
-
it "should possible to change the dir of images" do
|
|
227
|
-
config.show_images :mode => :street_fighter
|
|
228
|
-
config.pending_image.should == image('street_fighter/pending.gif')
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
it "should possible to change the dir of the images" do
|
|
232
|
-
config.show_images :mode => :toy_story
|
|
233
|
-
config.sucess_image.should == image('toy_story/sucess.png')
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
it "should possible to change the dir of the images" do
|
|
237
|
-
config.show_images :mode => :fuuu
|
|
238
|
-
config.sucess_image.should == image('fuuu/sucess.png')
|
|
239
|
-
config.pending_image.should == image('fuuu/pending.png')
|
|
240
|
-
config.failure_image.should == image('fuuu/failure.png')
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
it "should possible to change the dir of the images" do
|
|
244
|
-
config.show_images :mode => custom_image_dir
|
|
245
|
-
config.sucess_image.should == custom_image('images/sucess.png')
|
|
246
|
-
end
|
|
247
|
-
end
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
describe '#before_run' do
|
|
251
|
-
|
|
252
|
-
it "should persist the proc object in the before callback" do
|
|
253
|
-
proc = Proc.new { 'To Infinity and beyond!' }
|
|
254
|
-
config.before_run(&proc)
|
|
255
|
-
config.before_callback.should be == proc
|
|
256
|
-
end
|
|
257
|
-
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
describe '#after_run' do
|
|
261
|
-
|
|
262
|
-
it "should persist the proc object in the after callback" do
|
|
263
|
-
proc = Proc.new { 'To Infinity and beyond!' }
|
|
264
|
-
config.after_run(&proc)
|
|
265
|
-
config.after_callback.should be == proc
|
|
266
|
-
end
|
|
267
|
-
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
describe '#before' do
|
|
271
|
-
|
|
272
|
-
it "should set the before callback if pass not hook" do
|
|
273
|
-
config.before(&block)
|
|
274
|
-
config.before_callback.should == block
|
|
275
|
-
end
|
|
276
|
-
|
|
277
|
-
it "should possible to set the before_run block" do
|
|
278
|
-
config.before(:all, &block)
|
|
279
|
-
config.before_callback.should == block
|
|
280
|
-
end
|
|
281
|
-
|
|
282
|
-
it "should possible to set before each ruby block" do
|
|
283
|
-
config.before(:each_ruby, &block)
|
|
284
|
-
config.before_each_ruby_callback.should == block
|
|
285
|
-
end
|
|
286
|
-
|
|
287
|
-
it "should not set before_run block in :each_ruby option" do
|
|
288
|
-
config.before(:each_ruby, &block)
|
|
289
|
-
config.before_callback.should be_nil
|
|
290
|
-
end
|
|
291
|
-
|
|
292
|
-
it "should not set before_run block in :all option" do
|
|
293
|
-
config.before(:all, &block)
|
|
294
|
-
config.before_each_ruby_callback.should be_nil
|
|
295
|
-
end
|
|
296
|
-
|
|
297
|
-
end
|
|
298
|
-
|
|
299
|
-
describe '#after' do
|
|
300
|
-
|
|
301
|
-
it "should set the after callback if pass not hook" do
|
|
302
|
-
config.after(&block)
|
|
303
|
-
config.after_callback.should == block
|
|
304
|
-
end
|
|
305
|
-
|
|
306
|
-
it "should possible to set the after block" do
|
|
307
|
-
config.after(:all, &block)
|
|
308
|
-
config.after_callback.should == block
|
|
309
|
-
end
|
|
310
|
-
|
|
311
|
-
it "should possible to set after each ruby block" do
|
|
312
|
-
config.after(:each_ruby, &block)
|
|
313
|
-
config.after_each_ruby_callback.should == block
|
|
314
|
-
end
|
|
315
|
-
|
|
316
|
-
it "should not set after block in :each_ruby option" do
|
|
317
|
-
config.after(:each_ruby, &block)
|
|
318
|
-
config.after_callback.should be_nil
|
|
319
|
-
end
|
|
320
|
-
|
|
321
|
-
it "should not set after each ruby block in :all option" do
|
|
322
|
-
config.after(:all, &block)
|
|
323
|
-
config.after_each_ruby_callback.should be_nil
|
|
324
|
-
end
|
|
325
|
-
|
|
326
|
-
end
|
|
327
|
-
|
|
328
|
-
describe '#replace_patterns' do
|
|
329
|
-
|
|
330
|
-
it "should evaluate in the context of application framework" do
|
|
331
|
-
config.replace_patterns do |application|
|
|
332
|
-
end.should be_instance_of(InfinityTest::Application)
|
|
333
|
-
end
|
|
334
|
-
|
|
335
|
-
it "should replace patterns to the application framework" do
|
|
336
|
-
config.replace_patterns do |application|
|
|
337
|
-
application.app_framework.lib_pattern = "^my_lib/(.*)\.rb"
|
|
338
|
-
end
|
|
339
|
-
InfinityTest.application.app_framework.lib_pattern.should == "^my_lib/(.*)\.rb"
|
|
340
|
-
end
|
|
341
|
-
|
|
342
|
-
it "should replace patterns and replace the test pattern to test framework lookup" do
|
|
343
|
-
config.replace_patterns do |application|
|
|
344
|
-
application.app_framework.test_pattern = "^my_unusual_spec_directory/unit/(.*)_spec.rb"
|
|
345
|
-
application.test_framework.test_pattern = "my_unusual_spec_directory/unit/*_spec.rb"
|
|
346
|
-
end
|
|
347
|
-
InfinityTest.application.app_framework.test_pattern.should == "^my_unusual_spec_directory/unit/(.*)_spec.rb"
|
|
348
|
-
InfinityTest.application.test_framework.test_pattern.should == "my_unusual_spec_directory/unit/*_spec.rb"
|
|
349
|
-
end
|
|
350
|
-
|
|
351
|
-
end
|
|
352
|
-
|
|
353
|
-
describe '#clear' do
|
|
354
|
-
|
|
355
|
-
it "should call the clear in the system" do
|
|
356
|
-
config.should_receive(:system).with('clear')
|
|
357
|
-
config.clear :terminal
|
|
358
|
-
end
|
|
359
|
-
|
|
360
|
-
end
|
|
361
|
-
|
|
362
|
-
end
|
|
363
|
-
end
|
|
364
|
-
|
|
365
|
-
describe '#infinity_test' do
|
|
366
|
-
it 'should return a instance of Configuration class' do
|
|
367
|
-
infinity_test do
|
|
368
|
-
end.should be_instance_of(InfinityTest::Configuration)
|
|
369
|
-
end
|
|
370
|
-
|
|
371
|
-
it "Infinity test Dsl of config file should yield in the Configuration scope" do
|
|
372
|
-
infinity_test do
|
|
373
|
-
use
|
|
374
|
-
end.class.should equal InfinityTest::Configuration
|
|
375
|
-
end
|
|
376
|
-
|
|
377
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module InfinityTest
|
|
4
|
-
describe ContinuousTesting do
|
|
5
|
-
let(:continuous_testing) { ContinuousTesting.new }
|
|
6
|
-
it "should keep the application object" do
|
|
7
|
-
continuous_testing.application.should equal InfinityTest.application
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it "should keep the watchr object" do
|
|
11
|
-
continuous_testing.watchr.should equal InfinityTest.watchr
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe '#initialize_watchr!' do
|
|
15
|
-
|
|
16
|
-
it "should call add_signal and run_with_watchr!" do
|
|
17
|
-
continuous_testing.should_receive(:add_signal)
|
|
18
|
-
continuous_testing.should_receive(:run_with_watchr!)
|
|
19
|
-
continuous_testing.initialize_watchr!
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module InfinityTest
|
|
4
|
-
describe Environment do
|
|
5
|
-
include Environment
|
|
6
|
-
describe '#environments' do
|
|
7
|
-
it "should raise a exception if not passed a block" do
|
|
8
|
-
expect { environments }.should raise_exception
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "should run in the scope of RVM environment" do
|
|
12
|
-
pending
|
|
13
|
-
expect {
|
|
14
|
-
environments do |environment, ruby_version|
|
|
15
|
-
environment.should be_instance_of(RVM::Environment)
|
|
16
|
-
end
|
|
17
|
-
}.to_not raise_exception
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module InfinityTest
|
|
4
|
-
describe HeuristicsHelper do
|
|
5
|
-
include HeuristicsHelper
|
|
6
|
-
|
|
7
|
-
describe '#heuristics' do
|
|
8
|
-
it "should be instance of InfinityTest Heuristics" do
|
|
9
|
-
heuristics do
|
|
10
|
-
end.should be_instance_of(InfinityTest::Heuristics)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module InfinityTest
|
|
4
|
-
describe Heuristics do
|
|
5
|
-
|
|
6
|
-
before do
|
|
7
|
-
@application = application_with_rspec
|
|
8
|
-
InfinityTest.stub!(:watchr).and_return(Watchr::Script.new)
|
|
9
|
-
InfinityTest.stub!(:application).and_return(@application)
|
|
10
|
-
@heuristics = Heuristics.new
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe '#initialize' do
|
|
14
|
-
|
|
15
|
-
it "should create the patterns instance of Hash" do
|
|
16
|
-
@heuristics.patterns.should be_instance_of(Hash)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it "should create the script instance variable" do
|
|
20
|
-
@heuristics.script.should be_instance_of(Watchr::Script)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "should have empty rules" do
|
|
24
|
-
@heuristics.script.rules.should be_empty
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe '#add' do
|
|
30
|
-
|
|
31
|
-
it "should add the watch method and persist the pattern" do
|
|
32
|
-
@heuristics.add("^lib/*/(.*)\.rb")
|
|
33
|
-
@heuristics.script.rules.should have(1).items
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "should add the pattern to #patterns instance" do
|
|
37
|
-
@heuristics.add(/^(test|spec)\/fixtures\/(.*).yml$/)
|
|
38
|
-
@heuristics.should have_pattern(/^(test|spec)\/fixtures\/(.*).yml$/)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "should add other pattern to #patterns instance" do
|
|
42
|
-
@heuristics.add("^lib/*/(.*)\.rb")
|
|
43
|
-
@heuristics.should have_pattern("^lib/*/(.*)\.rb")
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
it "should add the block object to #patterns instance" do
|
|
47
|
-
proc = Proc.new { 'a' }
|
|
48
|
-
@heuristics.add("^lib/*/(.*)\.rb", &proc)
|
|
49
|
-
@heuristics.patterns.should have_value(proc)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
describe '#all' do
|
|
55
|
-
|
|
56
|
-
it "should return all the patterns" do
|
|
57
|
-
@heuristics.add('^lib/*_spec.rb')
|
|
58
|
-
@heuristics.all.should eql ['^lib/*_spec.rb']
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it "should return all the patterns the InfinityTest will watch" do
|
|
62
|
-
@heuristics.add('^config/application.rb')
|
|
63
|
-
@heuristics.add('^spec/spec_helper.rb')
|
|
64
|
-
@heuristics.all.should have(2).items
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
it "should include all the patterns the InfinityTest will watch each" do
|
|
68
|
-
@heuristics.add '^config/application.rb'
|
|
69
|
-
@heuristics.add '^spec/spec_helper.rb'
|
|
70
|
-
all = @heuristics.all
|
|
71
|
-
all.should include '^config/application.rb'
|
|
72
|
-
all.should include '^spec/spec_helper.rb'
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
describe '#run' do
|
|
78
|
-
|
|
79
|
-
let(:binary_path_match_data) { match_data = /(infinity_test\/binary_path)/.match('infinity_test/binary_path') }
|
|
80
|
-
|
|
81
|
-
it "should call the contruct commands for test file" do
|
|
82
|
-
@application.should_receive(:run_commands_for_file).with('spec/infinity_test/binary_path_spec.rb')
|
|
83
|
-
@heuristics.run(:test_for => binary_path_match_data)
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
it "should run all the test files" do
|
|
87
|
-
@application.should_receive(:run_commands_for_file).with(@application.all_test_files.join(' '))
|
|
88
|
-
@heuristics.run(:all => :files)
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
describe '#remove' do
|
|
94
|
-
|
|
95
|
-
before do
|
|
96
|
-
@heuristics.add('^lib/*/(.*)_spec.rb')
|
|
97
|
-
@heuristics.add('^spec/*/(.*)_spec.rb')
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
it { @heuristics.patterns.should have(2).items }
|
|
101
|
-
|
|
102
|
-
it { @heuristics.script.rules.should have(2).items }
|
|
103
|
-
|
|
104
|
-
it "should remove the pattern from patterns" do
|
|
105
|
-
@heuristics.remove('^lib/*/(.*)_spec.rb')
|
|
106
|
-
@heuristics.should_not have_pattern('^lib/*/(.*)_spec.rb')
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
it "should remove the rules from watchr" do
|
|
110
|
-
@heuristics.remove('^lib/*/(.*)_spec.rb')
|
|
111
|
-
@heuristics.script.rules.should have(1).items
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
it "should remove all the rules from watchr" do
|
|
115
|
-
@heuristics.remove :all
|
|
116
|
-
@heuristics.script.rules.should be_empty
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
it "should remove all the patterns" do
|
|
120
|
-
@heuristics.remove :all
|
|
121
|
-
@heuristics.patterns.should be_empty
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
end
|
|
127
|
-
end
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module InfinityTest
|
|
4
|
-
describe Options do
|
|
5
|
-
|
|
6
|
-
context "when parsing" do
|
|
7
|
-
|
|
8
|
-
it "should parse --rspec and return rspec" do
|
|
9
|
-
parse_options('--rspec')
|
|
10
|
-
@options[:test_framework].should equal :rspec
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "should not return rspec as test framework when not parse rspec" do
|
|
14
|
-
parse_options('--test-unit')
|
|
15
|
-
@options[:test_framework].should_not equal :rspec
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it "should parse --bacon and return bacon" do
|
|
19
|
-
parse_options('--bacon')
|
|
20
|
-
@options[:test_framework].should equal :bacon
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
it "should not parse --test-unit" do
|
|
24
|
-
parse_options('--rspec')
|
|
25
|
-
@options[:test_framework].should_not equal :bacon
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it "should parse --test-unit and return test_unit" do
|
|
29
|
-
parse_options('--test-unit')
|
|
30
|
-
@options[:test_framework].should equal :test_unit
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it "should not parse --test-unit" do
|
|
34
|
-
parse_options('--rspec')
|
|
35
|
-
@options[:test_framework].should_not equal :test_unit
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "should parse --rvm-versions and return an array" do
|
|
39
|
-
parse_options('--rubies=1.8.6,1.8.7')
|
|
40
|
-
@options[:rubies].should eql '1.8.6,1.8.7'
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it "should parse --rvm-versions with dashes" do
|
|
44
|
-
parse_options('--rubies=1.8.7-p249,1.9.1-p378')
|
|
45
|
-
@options[:rubies].should eql '1.8.7-p249,1.9.1-p378'
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it "should parse --verbose" do
|
|
49
|
-
parse_options('--verbose')
|
|
50
|
-
@options[:verbose].should be_true
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it "should parse --skip-bundler" do
|
|
54
|
-
parse_options('--skip-bundler')
|
|
55
|
-
@options[:skip_bundler?].should be_true
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it "should return false for --skip-bundler option" do
|
|
59
|
-
parse_options('--rails')
|
|
60
|
-
@options[:skip_bundler?].should be_false
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
it "should return rails as app framework when parse rails" do
|
|
64
|
-
parse_options('--rails')
|
|
65
|
-
@options[:app_framework].should equal :rails
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it "should return rubygems as app framework when parse rubygems" do
|
|
69
|
-
parse_options('--rubygems')
|
|
70
|
-
@options[:app_framework].should equal :rubygems
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it "should parse the cucumber option" do
|
|
74
|
-
pending
|
|
75
|
-
parse_options('--cucumber')
|
|
76
|
-
@options[:cucumber].should be_true
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
it "should parse the patterns options" do
|
|
80
|
-
parse_options('--heuristics')
|
|
81
|
-
@options[:show_heuristics?].should be_true
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def parse_options(*arguments)
|
|
87
|
-
@options = InfinityTest::Options.new(arguments)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
end
|
|
91
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
describe InfinityTest::Runner do
|
|
4
|
-
|
|
5
|
-
let(:runner_class) { InfinityTest::Runner }
|
|
6
|
-
|
|
7
|
-
describe '#initialize' do
|
|
8
|
-
|
|
9
|
-
it "should set the application object" do
|
|
10
|
-
runner_class.new(['--test-unit']).application.should be_instance_of(InfinityTest::Application)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
it "should set the Option Object" do
|
|
14
|
-
runner_class.new(['--rspec']).options.should be_instance_of(InfinityTest::Options)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe '#run!' do
|
|
20
|
-
let(:heuristics_runner) { runner_class.new(['--heuristics']) }
|
|
21
|
-
|
|
22
|
-
it "should call list heuristics" do
|
|
23
|
-
heuristics_runner.should_receive(:list_heuristics!)
|
|
24
|
-
heuristics_runner.run!
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe "#start_continuous_testing!" do
|
|
30
|
-
let(:empty_runner) { InfinityTest::Runner.new([]) }
|
|
31
|
-
let(:mock_continuous_testing) { @mock ||= mock(InfinityTest::ContinuousTesting) }
|
|
32
|
-
|
|
33
|
-
it "should call start for Continuous Testing" do
|
|
34
|
-
application = application_with_rspec
|
|
35
|
-
InfinityTest::ContinuousTesting.should_receive(:new).and_return(mock_continuous_testing)
|
|
36
|
-
mock_continuous_testing.should_receive(:start!)
|
|
37
|
-
empty_runner.start_continuous_testing!
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|