infinity_test 1.0.3 → 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.
Files changed (148) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +31 -0
  3. data/.gitignore +3 -0
  4. data/.rspec +2 -2
  5. data/AI_INTEGRATION_IDEAS.md +203 -0
  6. data/Gemfile +3 -15
  7. data/History.markdown +82 -0
  8. data/{.infinity_test → INFINITY_TEST} +18 -15
  9. data/LICENSE.txt +2 -2
  10. data/README.md +627 -0
  11. data/Rakefile +1 -65
  12. data/TODO.markdown +24 -19
  13. data/bin/infinity_test +1 -4
  14. data/images/fuuu/pending.png +0 -0
  15. data/images/fuuu/success.png +0 -0
  16. data/infinity_test.gemspec +41 -189
  17. data/lib/infinity_test/core/auto_discover.rb +67 -0
  18. data/lib/infinity_test/core/base.rb +369 -0
  19. data/lib/infinity_test/core/callback.rb +59 -0
  20. data/lib/infinity_test/core/changed_file.rb +13 -0
  21. data/lib/infinity_test/core/command_builder.rb +48 -0
  22. data/lib/infinity_test/core/command_runner.rb +62 -0
  23. data/lib/infinity_test/core/configuration_merge.rb +37 -0
  24. data/lib/infinity_test/core/continuous_test_server.rb +106 -0
  25. data/lib/infinity_test/core/load_configuration.rb +48 -0
  26. data/lib/infinity_test/core/notifier.rb +59 -0
  27. data/lib/infinity_test/core/options.rb +134 -0
  28. data/lib/infinity_test/core/runner.rb +18 -0
  29. data/lib/infinity_test/core/version.rb +5 -0
  30. data/lib/infinity_test/framework/base.rb +57 -0
  31. data/lib/infinity_test/framework/padrino.rb +33 -0
  32. data/lib/infinity_test/framework/rails.rb +35 -0
  33. data/lib/infinity_test/framework/rubygems.rb +29 -0
  34. data/lib/infinity_test/framework/shared_example.rb +47 -0
  35. data/lib/infinity_test/observer/base.rb +40 -0
  36. data/lib/infinity_test/observer/filewatcher.rb +72 -0
  37. data/lib/infinity_test/observer/listen.rb +74 -0
  38. data/lib/infinity_test/observer/shared_example.rb +35 -0
  39. data/lib/infinity_test/old_dsl/configuration.rb +26 -0
  40. data/lib/infinity_test/strategy/base.rb +34 -0
  41. data/lib/infinity_test/strategy/rbenv.rb +32 -0
  42. data/lib/infinity_test/strategy/ruby_default.rb +20 -0
  43. data/lib/infinity_test/strategy/rvm.rb +50 -0
  44. data/lib/infinity_test/strategy/shared_example.rb +32 -0
  45. data/lib/infinity_test/test_framework/base.rb +64 -0
  46. data/lib/infinity_test/test_framework/rspec.rb +48 -0
  47. data/lib/infinity_test/test_framework/shared_example.rb +56 -0
  48. data/lib/infinity_test/test_framework/test_unit.rb +57 -0
  49. data/lib/infinity_test.rb +53 -35
  50. data/spec/infinity_test/core/auto_discover_spec.rb +149 -0
  51. data/spec/infinity_test/core/base_spec.rb +240 -0
  52. data/spec/infinity_test/core/callback_spec.rb +89 -0
  53. data/spec/infinity_test/core/changed_file_spec.rb +26 -0
  54. data/spec/infinity_test/core/command_builder_spec.rb +38 -0
  55. data/spec/infinity_test/core/configuration_merge_spec.rb +124 -0
  56. data/spec/infinity_test/core/continuous_test_server_spec.rb +116 -0
  57. data/spec/infinity_test/core/load_configuration_spec.rb +43 -0
  58. data/spec/infinity_test/core/notifier_spec.rb +151 -0
  59. data/spec/infinity_test/core/options_spec.rb +168 -0
  60. data/spec/infinity_test/core/runner_spec.rb +17 -0
  61. data/spec/infinity_test/framework/base_spec.rb +55 -0
  62. data/spec/infinity_test/framework/padrino_spec.rb +36 -0
  63. data/spec/infinity_test/framework/rails_spec.rb +36 -0
  64. data/spec/infinity_test/framework/rubygems_spec.rb +34 -0
  65. data/spec/infinity_test/observer/base_spec.rb +78 -0
  66. data/spec/infinity_test/observer/filewatcher_spec.rb +51 -0
  67. data/spec/infinity_test/observer/listen_spec.rb +50 -0
  68. data/spec/infinity_test/{builder_spec.rb → strategy/base_spec.rb} +1 -2
  69. data/spec/infinity_test/strategy/rbenv_spec.rb +53 -0
  70. data/spec/infinity_test/strategy/ruby_default_spec.rb +32 -0
  71. data/spec/infinity_test/strategy/rvm_spec.rb +69 -0
  72. data/spec/infinity_test/test_framework/rspec_spec.rb +119 -0
  73. data/spec/infinity_test/test_framework/test_unit_spec.rb +193 -0
  74. data/spec/spec_helper.rb +34 -119
  75. metadata +272 -176
  76. data/.rvmrc +0 -1
  77. data/Gemfile.lock +0 -62
  78. data/Readme.markdown +0 -147
  79. data/Tasks +0 -4
  80. data/VERSION.yml +0 -5
  81. data/buzz_images/buzz_lightyear.jpg +0 -0
  82. data/buzz_images/buzz_lightyear_continencia.gif +0 -0
  83. data/buzz_images/to_infinity_and_beyond.png +0 -0
  84. data/features/heuristics.feature +0 -23
  85. data/features/support/env.rb +0 -2
  86. data/images/fuuu/sucess.png +0 -0
  87. data/lib/infinity_test/application.rb +0 -362
  88. data/lib/infinity_test/application_library/rails.rb +0 -94
  89. data/lib/infinity_test/application_library/rubygems.rb +0 -43
  90. data/lib/infinity_test/binary_path.rb +0 -43
  91. data/lib/infinity_test/builder.rb +0 -66
  92. data/lib/infinity_test/command.rb +0 -58
  93. data/lib/infinity_test/configuration.rb +0 -277
  94. data/lib/infinity_test/continuous_testing.rb +0 -40
  95. data/lib/infinity_test/dependencies.rb +0 -80
  96. data/lib/infinity_test/environment.rb +0 -15
  97. data/lib/infinity_test/heuristics.rb +0 -36
  98. data/lib/infinity_test/heuristics_helper.rb +0 -9
  99. data/lib/infinity_test/options.rb +0 -96
  100. data/lib/infinity_test/runner.rb +0 -38
  101. data/lib/infinity_test/test_framework.rb +0 -110
  102. data/lib/infinity_test/test_library/bacon.rb +0 -55
  103. data/lib/infinity_test/test_library/cucumber.rb +0 -22
  104. data/lib/infinity_test/test_library/rspec.rb +0 -60
  105. data/lib/infinity_test/test_library/test_unit.rb +0 -52
  106. data/lib/infinity_test/test_unit_loader.rb +0 -5
  107. data/spec/factories/buzz/lib/buzz.rb +0 -0
  108. data/spec/factories/buzz/spec/buzz_spec.rb +0 -0
  109. data/spec/factories/company/Gemfile +0 -0
  110. data/spec/factories/company/lib/company.rb +0 -0
  111. data/spec/factories/company/test/company_test.rb +0 -0
  112. data/spec/factories/images/failure.png +0 -0
  113. data/spec/factories/images/pending.png +0 -0
  114. data/spec/factories/images/sucess.png +0 -0
  115. data/spec/factories/infinity_test +0 -5
  116. data/spec/factories/infinity_test_example +0 -7
  117. data/spec/factories/slinky/spec/slinky/slinky_spec.rb +0 -0
  118. data/spec/factories/travel/lib/travel.rb +0 -0
  119. data/spec/factories/travel/test/partner_test.rb +0 -0
  120. data/spec/factories/travel/test/travel_test.rb +0 -0
  121. data/spec/factories/wood/lib/wood.rb +0 -0
  122. data/spec/factories/wood/spec/wood_spec.rb +0 -0
  123. data/spec/infinity_test/application_library/rails_spec.rb +0 -140
  124. data/spec/infinity_test/application_library/rubygems_spec.rb +0 -52
  125. data/spec/infinity_test/application_spec.rb +0 -434
  126. data/spec/infinity_test/binary_path_spec.rb +0 -72
  127. data/spec/infinity_test/command_spec.rb +0 -53
  128. data/spec/infinity_test/configuration_spec.rb +0 -382
  129. data/spec/infinity_test/continuous_testing_spec.rb +0 -25
  130. data/spec/infinity_test/environment_spec.rb +0 -23
  131. data/spec/infinity_test/heuristics_helper_spec.rb +0 -15
  132. data/spec/infinity_test/heuristics_spec.rb +0 -127
  133. data/spec/infinity_test/options_spec.rb +0 -111
  134. data/spec/infinity_test/runner_spec.rb +0 -42
  135. data/spec/infinity_test/test_framework_spec.rb +0 -127
  136. data/spec/infinity_test/test_library/bacon_spec.rb +0 -150
  137. data/spec/infinity_test/test_library/cucumber_spec.rb +0 -8
  138. data/spec/infinity_test/test_library/rspec_spec.rb +0 -189
  139. data/spec/infinity_test/test_library/test_unit_spec.rb +0 -184
  140. data/spec/infinity_test_spec.rb +0 -40
  141. /data/images/faces/{sucess.png → success.png} +0 -0
  142. /data/images/hands/{sucess.png → success.png} +0 -0
  143. /data/images/mario_bros/{sucess.jpg → success.jpg} +0 -0
  144. /data/images/rails/{sucess.png → success.png} +0 -0
  145. /data/images/rubies/{sucess.png → success.png} +0 -0
  146. /data/images/simpson/{sucess.jpg → success.jpg} +0 -0
  147. /data/images/street_fighter/{sucess.jpg → success.jpg} +0 -0
  148. /data/images/toy_story/{sucess.png → success.png} +0 -0
@@ -1,382 +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 ruby specific options" do
101
- config.use :specific_options => {'v-1' => '-o'}
102
- config.specific_options.should == {'v-1' => '-o'}
103
- end
104
-
105
- it "should set the test unit when not set the test framework" do
106
- config.use
107
- config.test_framework.should equal :test_unit
108
- end
109
-
110
- it "should return the test framework" do
111
- config.use :test_framework => :rspec
112
- config.test_framework.should equal :rspec
113
- end
114
-
115
- it "should return bacon too for the test framework" do
116
- config.use :test_framework => :bacon
117
- config.test_framework.should equal :bacon
118
- end
119
-
120
- it "should possible to set the test unit for test framework" do
121
- config.use :test_framework => :test_unit
122
- config.test_framework.should equal :test_unit
123
- end
124
-
125
- it "should set the verbose option" do
126
- config.use :verbose => true
127
- config.verbose.should be_true
128
- end
129
-
130
- it "should set to false as default" do
131
- config.verbose.should equal false
132
- end
133
-
134
- it "should be possible to use Rails framework" do
135
- config.use :app_framework => :rails
136
- config.app_framework.should equal :rails
137
- end
138
-
139
- it "should set the rubygems as default app framework" do
140
- config.use
141
- config.app_framework.should equal :rubygems
142
- end
143
-
144
- it "should be possible to set the cucumber option" do
145
- config.use :cucumber => true
146
- config.cucumber?.should be_true
147
- end
148
-
149
- it "should be false as default" do
150
- config.cucumber?.should be_false
151
- end
152
-
153
- it "should return false if cucumber is nil in #use method" do
154
- config.use :cucumber => nil
155
- config.cucumber?.should be_false
156
- end
157
-
158
- end
159
-
160
- describe '#skip_bundler!' do
161
-
162
- it "should return true if skip bundler" do
163
- config.skip_bundler!
164
- config.skip_bundler?.should be_true
165
- end
166
-
167
- it "should return false if not skip bundler (default)" do
168
- config.skip_bundler?.should be_false
169
- end
170
-
171
- end
172
-
173
- describe '#ignore' do
174
-
175
- it "should be empty when not have dir/files to ignore" do
176
- config.ignore
177
- config.exceptions_to_ignore.should be == []
178
- end
179
-
180
- it "should set the exception to ignore" do
181
- config.ignore :exceptions => %w(.svn)
182
- config.exceptions_to_ignore.should be == %w(.svn)
183
- end
184
-
185
- it "should set the exceptions to ignore changes" do
186
- config.ignore :exceptions => %w(.svn .hg .git vendor tmp config rerun.txt)
187
- config.exceptions_to_ignore.should be == %w(.svn .hg .git vendor tmp config rerun.txt)
188
- end
189
-
190
- end
191
-
192
- describe '#show_images' do
193
-
194
- before { @config = Configuration.new }
195
-
196
- let(:config) { @config }
197
-
198
- context 'on default images' do
199
- before { @config.notifications :growl }
200
-
201
- it { config.sucess_image.should == image('simpson/sucess.jpg') }
202
-
203
- it { config.pending_image.should == image('simpson/pending.jpg') }
204
-
205
- it { config.failure_image.should == image('simpson/failure.gif') }
206
-
207
- end
208
-
209
- context 'on setting my own image' do
210
- before { config.notifications :lib_notify }
211
-
212
- it "should be possible to customize success image" do
213
- config.show_images :sucess => image('other.png')
214
- config.sucess_image.should == image('other.png')
215
- end
216
-
217
- it "should be possible to customize failure image" do
218
- config.show_images :failure => image('failure_picture.png')
219
- config.failure_image.should == image('failure_picture.png')
220
- end
221
-
222
- it "should be possible to customize failure image" do
223
- config.show_images :pending => image('pending_picture.png')
224
- config.pending_image.should == image('pending_picture.png')
225
- end
226
- end
227
-
228
- context 'setting the dirrectory image or modes' do
229
- before { config.notifications :growl }
230
-
231
- it "should possible to change the dir of images" do
232
- config.show_images :mode => :street_fighter
233
- config.pending_image.should == image('street_fighter/pending.gif')
234
- end
235
-
236
- it "should possible to change the dir of the images" do
237
- config.show_images :mode => :toy_story
238
- config.sucess_image.should == image('toy_story/sucess.png')
239
- end
240
-
241
- it "should possible to change the dir of the images" do
242
- config.show_images :mode => :fuuu
243
- config.sucess_image.should == image('fuuu/sucess.png')
244
- config.pending_image.should == image('fuuu/pending.png')
245
- config.failure_image.should == image('fuuu/failure.png')
246
- end
247
-
248
- it "should possible to change the dir of the images" do
249
- config.show_images :mode => custom_image_dir
250
- config.sucess_image.should == custom_image('images/sucess.png')
251
- end
252
- end
253
- end
254
-
255
- describe '#before_run' do
256
-
257
- it "should persist the proc object in the before callback" do
258
- proc = Proc.new { 'To Infinity and beyond!' }
259
- config.before_run(&proc)
260
- config.before_callback.should be == proc
261
- end
262
-
263
- end
264
-
265
- describe '#after_run' do
266
-
267
- it "should persist the proc object in the after callback" do
268
- proc = Proc.new { 'To Infinity and beyond!' }
269
- config.after_run(&proc)
270
- config.after_callback.should be == proc
271
- end
272
-
273
- end
274
-
275
- describe '#before' do
276
-
277
- it "should set the before callback if pass not hook" do
278
- config.before(&block)
279
- config.before_callback.should == block
280
- end
281
-
282
- it "should possible to set the before_run block" do
283
- config.before(:all, &block)
284
- config.before_callback.should == block
285
- end
286
-
287
- it "should possible to set before each ruby block" do
288
- config.before(:each_ruby, &block)
289
- config.before_each_ruby_callback.should == block
290
- end
291
-
292
- it "should not set before_run block in :each_ruby option" do
293
- config.before(:each_ruby, &block)
294
- config.before_callback.should be_nil
295
- end
296
-
297
- it "should not set before_run block in :all option" do
298
- config.before(:all, &block)
299
- config.before_each_ruby_callback.should be_nil
300
- end
301
-
302
- end
303
-
304
- describe '#after' do
305
-
306
- it "should set the after callback if pass not hook" do
307
- config.after(&block)
308
- config.after_callback.should == block
309
- end
310
-
311
- it "should possible to set the after block" do
312
- config.after(:all, &block)
313
- config.after_callback.should == block
314
- end
315
-
316
- it "should possible to set after each ruby block" do
317
- config.after(:each_ruby, &block)
318
- config.after_each_ruby_callback.should == block
319
- end
320
-
321
- it "should not set after block in :each_ruby option" do
322
- config.after(:each_ruby, &block)
323
- config.after_callback.should be_nil
324
- end
325
-
326
- it "should not set after each ruby block in :all option" do
327
- config.after(:all, &block)
328
- config.after_each_ruby_callback.should be_nil
329
- end
330
-
331
- end
332
-
333
- describe '#replace_patterns' do
334
-
335
- it "should evaluate in the context of application framework" do
336
- config.replace_patterns do |application|
337
- end.should be_instance_of(InfinityTest::Application)
338
- end
339
-
340
- it "should replace patterns to the application framework" do
341
- config.replace_patterns do |application|
342
- application.app_framework.lib_pattern = "^my_lib/(.*)\.rb"
343
- end
344
- InfinityTest.application.app_framework.lib_pattern.should == "^my_lib/(.*)\.rb"
345
- end
346
-
347
- it "should replace patterns and replace the test pattern to test framework lookup" do
348
- config.replace_patterns do |application|
349
- application.app_framework.test_pattern = "^my_unusual_spec_directory/unit/(.*)_spec.rb"
350
- application.test_framework.test_pattern = "my_unusual_spec_directory/unit/*_spec.rb"
351
- end
352
- InfinityTest.application.app_framework.test_pattern.should == "^my_unusual_spec_directory/unit/(.*)_spec.rb"
353
- InfinityTest.application.test_framework.test_pattern.should == "my_unusual_spec_directory/unit/*_spec.rb"
354
- end
355
-
356
- end
357
-
358
- describe '#clear' do
359
-
360
- it "should call the clear in the system" do
361
- config.should_receive(:system).with('clear')
362
- config.clear :terminal
363
- end
364
-
365
- end
366
-
367
- end
368
- end
369
-
370
- describe '#infinity_test' do
371
- it 'should return a instance of Configuration class' do
372
- infinity_test do
373
- end.should be_instance_of(InfinityTest::Configuration)
374
- end
375
-
376
- it "Infinity test Dsl of config file should yield in the Configuration scope" do
377
- infinity_test do
378
- use
379
- end.class.should equal InfinityTest::Configuration
380
- end
381
-
382
- 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,111 +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 --rvm-versions with particual options" do
49
- parse_options('--rubies=jruby-6.6.6+-J-cp bar/whisky-in-the.jar:.')
50
- @options[:rubies].should eql 'jruby-6.6.6'
51
- end
52
-
53
- it "should parse --rvm-versions specific options" do
54
- parse_options('--rubies=jruby-6.6.6+-J-cp bar/whisky-in-the.jar:.')
55
- @options[:specific_options].should == {'jruby-6.6.6' => '-J-cp bar/whisky-in-the.jar:.'}
56
- end
57
-
58
- it "should parse rubies with multiples specific options" do
59
- parse_options('--rubies=jruby-1+-J-cp :.,jruby-2+-J-cp,1.9.2,jruby3+-J-cp :.')
60
- @options[:rubies].should == 'jruby-1,jruby-2,1.9.2,jruby3'
61
- end
62
-
63
- it "should parse particular options with multiples specific options" do
64
- parse_options('--rubies=jruby-1+-J-cp :.,jruby-2+-J-cp,1.9.2,jruby3+-J-cp :.')
65
- @options[:specific_options].should == {'jruby-1'=>'-J-cp :.','jruby-2'=>'-J-cp','1.9.2'=>nil,'jruby3'=>'-J-cp :.'}
66
- end
67
-
68
- it "should parse --verbose" do
69
- parse_options('--verbose')
70
- @options[:verbose].should be_true
71
- end
72
-
73
- it "should parse --skip-bundler" do
74
- parse_options('--skip-bundler')
75
- @options[:skip_bundler?].should be_true
76
- end
77
-
78
- it "should return false for --skip-bundler option" do
79
- parse_options('--rails')
80
- @options[:skip_bundler?].should be_false
81
- end
82
-
83
- it "should return rails as app framework when parse rails" do
84
- parse_options('--rails')
85
- @options[:app_framework].should equal :rails
86
- end
87
-
88
- it "should return rubygems as app framework when parse rubygems" do
89
- parse_options('--rubygems')
90
- @options[:app_framework].should equal :rubygems
91
- end
92
-
93
- it "should parse the cucumber option" do
94
- pending
95
- parse_options('--cucumber')
96
- @options[:cucumber].should be_true
97
- end
98
-
99
- it "should parse the patterns options" do
100
- parse_options('--heuristics')
101
- @options[:show_heuristics?].should be_true
102
- end
103
-
104
- end
105
-
106
- def parse_options(*arguments)
107
- @options = InfinityTest::Options.new(arguments)
108
- end
109
-
110
- end
111
- end