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.
Files changed (149) 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 +48 -0
  9. data/LICENSE.txt +2 -2
  10. data/README.md +627 -0
  11. data/Rakefile +1 -65
  12. data/TODO.markdown +26 -9
  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 -191
  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 +276 -205
  76. data/.infinity_test +0 -36
  77. data/.rvmrc +0 -1
  78. data/Gemfile.lock +0 -62
  79. data/Readme.markdown +0 -122
  80. data/Tasks +0 -4
  81. data/VERSION.yml +0 -5
  82. data/buzz_images/buzz_lightyear.jpg +0 -0
  83. data/buzz_images/buzz_lightyear_continencia.gif +0 -0
  84. data/buzz_images/to_infinity_and_beyond.png +0 -0
  85. data/features/heuristics.feature +0 -23
  86. data/features/support/env.rb +0 -2
  87. data/images/fuuu/sucess.png +0 -0
  88. data/lib/infinity_test/application.rb +0 -355
  89. data/lib/infinity_test/application_library/rails.rb +0 -94
  90. data/lib/infinity_test/application_library/rubygems.rb +0 -43
  91. data/lib/infinity_test/binary_path.rb +0 -43
  92. data/lib/infinity_test/builder.rb +0 -67
  93. data/lib/infinity_test/command.rb +0 -58
  94. data/lib/infinity_test/configuration.rb +0 -273
  95. data/lib/infinity_test/continuous_testing.rb +0 -40
  96. data/lib/infinity_test/dependencies.rb +0 -80
  97. data/lib/infinity_test/environment.rb +0 -15
  98. data/lib/infinity_test/heuristics.rb +0 -36
  99. data/lib/infinity_test/heuristics_helper.rb +0 -9
  100. data/lib/infinity_test/options.rb +0 -89
  101. data/lib/infinity_test/runner.rb +0 -38
  102. data/lib/infinity_test/test_framework.rb +0 -109
  103. data/lib/infinity_test/test_library/bacon.rb +0 -55
  104. data/lib/infinity_test/test_library/cucumber.rb +0 -22
  105. data/lib/infinity_test/test_library/rspec.rb +0 -58
  106. data/lib/infinity_test/test_library/test_unit.rb +0 -52
  107. data/lib/infinity_test/test_unit_loader.rb +0 -5
  108. data/spec/factories/buzz/lib/buzz.rb +0 -0
  109. data/spec/factories/buzz/spec/buzz_spec.rb +0 -0
  110. data/spec/factories/company/Gemfile +0 -0
  111. data/spec/factories/company/lib/company.rb +0 -0
  112. data/spec/factories/company/test/company_test.rb +0 -0
  113. data/spec/factories/images/failure.png +0 -0
  114. data/spec/factories/images/pending.png +0 -0
  115. data/spec/factories/images/sucess.png +0 -0
  116. data/spec/factories/infinity_test +0 -5
  117. data/spec/factories/infinity_test_example +0 -7
  118. data/spec/factories/slinky/spec/slinky/slinky_spec.rb +0 -0
  119. data/spec/factories/travel/lib/travel.rb +0 -0
  120. data/spec/factories/travel/test/partner_test.rb +0 -0
  121. data/spec/factories/travel/test/travel_test.rb +0 -0
  122. data/spec/factories/wood/lib/wood.rb +0 -0
  123. data/spec/factories/wood/spec/wood_spec.rb +0 -0
  124. data/spec/infinity_test/application_library/rails_spec.rb +0 -140
  125. data/spec/infinity_test/application_library/rubygems_spec.rb +0 -52
  126. data/spec/infinity_test/application_spec.rb +0 -424
  127. data/spec/infinity_test/binary_path_spec.rb +0 -72
  128. data/spec/infinity_test/command_spec.rb +0 -53
  129. data/spec/infinity_test/configuration_spec.rb +0 -377
  130. data/spec/infinity_test/continuous_testing_spec.rb +0 -25
  131. data/spec/infinity_test/environment_spec.rb +0 -23
  132. data/spec/infinity_test/heuristics_helper_spec.rb +0 -15
  133. data/spec/infinity_test/heuristics_spec.rb +0 -127
  134. data/spec/infinity_test/options_spec.rb +0 -91
  135. data/spec/infinity_test/runner_spec.rb +0 -42
  136. data/spec/infinity_test/test_framework_spec.rb +0 -127
  137. data/spec/infinity_test/test_library/bacon_spec.rb +0 -150
  138. data/spec/infinity_test/test_library/cucumber_spec.rb +0 -8
  139. data/spec/infinity_test/test_library/rspec_spec.rb +0 -185
  140. data/spec/infinity_test/test_library/test_unit_spec.rb +0 -184
  141. data/spec/infinity_test_spec.rb +0 -40
  142. /data/images/faces/{sucess.png → success.png} +0 -0
  143. /data/images/hands/{sucess.png → success.png} +0 -0
  144. /data/images/mario_bros/{sucess.jpg → success.jpg} +0 -0
  145. /data/images/rails/{sucess.png → success.png} +0 -0
  146. /data/images/rubies/{sucess.png → success.png} +0 -0
  147. /data/images/simpson/{sucess.jpg → success.jpg} +0 -0
  148. /data/images/street_fighter/{sucess.jpg → success.jpg} +0 -0
  149. /data/images/toy_story/{sucess.png → success.png} +0 -0
@@ -1,424 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module InfinityTest
4
- describe Application do
5
- let(:application) { Application.new }
6
- let(:config) { Configuration.new }
7
-
8
- before(:each) do
9
- @application = Application.new
10
- @current_dir = Dir.pwd
11
- end
12
-
13
- describe '#initialize' do
14
-
15
- it "should return the rubies in the config" do
16
- application_with(:rubies => ['1.8.7']).rubies.should == '1.8.7'
17
- end
18
-
19
- it "should return the rubies in the config" do
20
- application_with(:rubies => ['1.9.2']).rubies.should == '1.9.2'
21
- end
22
-
23
- it "should return the watchr script instance" do
24
- application_with_rspec.watchr.should be_instance_of(Watchr::Script)
25
- end
26
-
27
- it "should return the same object in the infinity test watchr" do
28
- application_with_rspec.watchr.should equal InfinityTest.watchr
29
- end
30
-
31
- it "should return the before callback" do
32
- app = application_with(:test_framework => :rspec)
33
- proc = Proc.new { 'To Infinity and beyond!' }
34
- app.config.before_run(&proc)
35
- app.before_callback.should equal proc
36
- end
37
-
38
- it "should return the block when set after callback" do
39
- app = application_with(:test_framework => :rspec)
40
- proc = Proc.new { 'To Infinity and beyond!' }
41
- app.config.after_run(&proc)
42
- app.after_callback.should equal proc
43
- end
44
- end
45
-
46
- describe '#heuristics' do
47
-
48
- it "should be instance of Heuristics class" do
49
- @application.config.heuristics {}
50
- @application.heuristics.should be_instance_of(InfinityTest::Heuristics)
51
- end
52
-
53
- it "should be the same heuristics setting in the configuration file" do
54
- heuristics = @application.config.heuristics {}
55
- heuristics.should equal @application.heuristics
56
- end
57
-
58
- end
59
-
60
- describe '#add_heuristics!' do
61
-
62
- it "rules should be empty before call add_heuristics! method" do
63
- InfinityTest.watchr.rules.should be_empty
64
- end
65
-
66
- it "should add rule sto the scope of Watchr::Script" do
67
- application.add_heuristics!
68
- InfinityTest.watchr.rules.should_not be_empty
69
- end
70
-
71
- end
72
-
73
- describe '#heuristics_users_high_priority!' do
74
-
75
- before do
76
- @application = application_with(:test_framework => :rspec, :app_framework => :rubygems)
77
- @application.heuristics.add('my_rule.rb')
78
- @application.heuristics.add('other_rule.rb')
79
- end
80
-
81
- it "should reverse the rules of watchr" do
82
- @application.heuristics_users_high_priority!
83
- @application.watchr.patterns[0].should == 'other_rule.rb'
84
- @application.watchr.patterns[1].should == 'my_rule.rb'
85
- end
86
-
87
- end
88
-
89
- describe '#have_gemfile?' do
90
-
91
- it "should return true when Gemfile exists" do
92
- application.should_receive(:gemfile).and_return(factory_company_gemfile)
93
- application.have_gemfile?.should be_true
94
- end
95
-
96
- it "should return false when Gemfile not exists" do
97
- application.should_receive(:gemfile).and_return(factory_buzz_gemfile)
98
- application.have_gemfile?.should be_false
99
- end
100
-
101
- end
102
-
103
- describe '#skip_bundler?' do
104
-
105
- it "should return true if skip_bundler! is set" do
106
- application.config.skip_bundler!
107
- application.skip_bundler?.should be_true
108
- end
109
-
110
- it "should return false if skip_bundler! is not set" do
111
- InfinityTest.should_receive(:configuration).and_return(config)
112
- Application.new.skip_bundler?.should be_false
113
- end
114
-
115
- end
116
-
117
- describe '#image_to_show' do
118
-
119
- before do
120
- @application_with_rspec = application_with(:test_framework => :rspec)
121
- @application_with_test_unit = application_with(:test_framework => :test_unit)
122
- end
123
-
124
- it "should return sucess when pass all the tests" do
125
- test_should_not_fail!(@application_with_rspec)
126
- test_should_not_pending!(@application_with_rspec)
127
- @application_with_rspec.image_to_show.should match /sucess/
128
- end
129
-
130
- it "should return failure when not pass all the tests" do
131
- test_should_fail!(@application_with_rspec)
132
- @application_with_rspec.image_to_show.should match /failure/
133
- end
134
-
135
- it "should return pending when have pending tests" do
136
- test_should_not_fail!(@application_with_rspec)
137
- test_should_pending!(@application_with_rspec)
138
- @application_with_rspec.image_to_show.should match /pending/
139
- end
140
-
141
- def test_should_not_fail!(object)
142
- object.test_framework.should_receive(:failure?).and_return(false)
143
- end
144
-
145
- def test_should_fail!(object)
146
- object.test_framework.should_receive(:failure?).and_return(true)
147
- end
148
-
149
- def test_should_pending!(object)
150
- object.test_framework.should_receive(:pending?).and_return(true)
151
- end
152
-
153
- def test_should_not_pending!(object)
154
- object.test_framework.should_receive(:pending?).and_return(false)
155
- end
156
-
157
- end
158
-
159
- describe '#notification_framework' do
160
-
161
- it "should return the Growl notification framework if has :growl" do
162
- application.config.notifications :growl
163
- application.notification_framework.should equal :growl
164
- end
165
-
166
- it "should return the Lib Notify if has :lib_notify" do
167
- application.config.notifications :lib_notify
168
- application.notification_framework.should equal :lib_notify
169
- end
170
-
171
- it "should cache notification" do
172
- application.config.notifications :lib_notify
173
- notification = application.notification_framework
174
- application.notification_framework.should equal notification
175
- end
176
-
177
- end
178
-
179
- describe '#test_framework' do
180
-
181
- before do
182
- @application = Application.new
183
- end
184
-
185
- it "should return the instance of Rspec when test framework is Rspec" do
186
- @application.config.use :test_framework => :rspec
187
- @application.test_framework.should be_instance_of(InfinityTest::TestLibrary::Rspec)
188
- end
189
-
190
- it "should return the instance of Rspec when test framework is Rspec" do
191
- @application.config.use :test_framework => :test_unit
192
- @application.test_framework.should be_instance_of(InfinityTest::TestLibrary::TestUnit)
193
- end
194
-
195
- it "should pass all the rubies for the test_framework TestUnit" do
196
- @application.config.use :test_framework => :test_unit, :rubies => ['1.9.1', '1.9.2']
197
- InfinityTest::TestLibrary::TestUnit.should_receive(:new).with(:rubies => '1.9.1,1.9.2')
198
- @application.test_framework
199
- end
200
-
201
- it "should pass all the rubies for the test_framework Rspec" do
202
- @application.config.use :test_framework => :rspec, :rubies => ['1.9.1', '1.9.2']
203
- InfinityTest::TestLibrary::Rspec.should_receive(:new).with(:rubies => '1.9.1,1.9.2')
204
- @application.test_framework
205
- end
206
-
207
- it "should pass the bacon framework too" do
208
- @application.config.use :test_framework => :bacon
209
- @application.test_framework.should be_instance_of(InfinityTest::TestLibrary::Bacon)
210
- end
211
-
212
- it "should cache the test framework instance" do
213
- @application.config.use :test_framework => :rspec
214
- test_framework = @application.test_framework
215
- @application.test_framework.should equal test_framework
216
- end
217
-
218
- end
219
-
220
- describe '#verbose?' do
221
-
222
- it "should return to false when not set verbose" do
223
- @application.verbose?.should equal false
224
- end
225
-
226
- it "should return true when set verbose to true" do
227
- @application.config.verbose = true
228
- @application.verbose?.should be_true
229
- end
230
-
231
- end
232
-
233
- describe '#notify!' do
234
-
235
- before do
236
- @growl = Growl.new
237
- end
238
-
239
- it "should do nothing when not have notification framework" do
240
- application.should_receive(:notification_framework).and_return(nil)
241
- application.notify!(:results => '0 examples', :ruby_version => '1.9.2').should be_nil
242
- end
243
-
244
- it "should notify when have notification framework" do
245
- application.config.notifications :growl
246
- application.should_receive(:growl).and_return(@growl)
247
- @growl.should_receive(:notify!)
248
- application.notify!(:results => '0 examples', :ruby_version => '1.8.7')
249
- end
250
-
251
- end
252
-
253
- describe '#run!' do
254
- let(:block) { Proc.new { 'w00t!' } }
255
-
256
- it 'should call the before all callback' do
257
- application_with_rspec.config.before(&block)
258
- application_with_rspec.before_callback.should_receive(:call)
259
- run_the_command(application_with_rspec)
260
- end
261
-
262
- it "should call the after all callback" do
263
- application_with_rspec.config.after(&block)
264
- application_with_rspec.after_callback.should_receive(:call)
265
- run_the_command(application_with_rspec)
266
- end
267
-
268
- it "should call the before each ruby callback" do
269
- application_with_rspec.config.before(:each_ruby, &block)
270
- application_with_rspec.before_each_ruby_callback.should_receive(:call)
271
- run_the_command(application_with_rspec)
272
- end
273
-
274
- it "should call the after each ruby callback" do
275
- application_with_rspec.config.after(:each_ruby, &block)
276
- application_with_rspec.after_each_ruby_callback.should_receive(:call)
277
- run_the_command(application_with_rspec)
278
- end
279
-
280
- end
281
-
282
- describe '#global_commands' do
283
-
284
- it "should call construct commands and assign to the global_commands" do
285
- @application.should_receive(:construct_commands).and_return(['rvm ...'])
286
- @application.global_commands.should == ['rvm ...']
287
- end
288
-
289
- it "should cache the global_commands instance variable" do
290
- expected = ['rvm 1.9.2']
291
- @application.should_receive(:construct_commands).once.and_return(expected)
292
- 2. times { @application.global_commands.should equal expected }
293
- end
294
-
295
- end
296
-
297
- describe '#run_global_commands!' do
298
-
299
- it "should run with the global_commands instance variable command" do
300
- @application.stub!(:global_commands).and_return('rvm 1.9.2 ruby -S rspec')
301
- @application.should_receive(:run!).with(@application.global_commands).and_return(true)
302
- @application.run_global_commands!
303
- end
304
-
305
- end
306
-
307
- describe '#construct_commands' do
308
-
309
- it "should call construct_commands on the test_framework" do
310
- application.test_framework.should_receive(:construct_commands)
311
- application.construct_commands
312
- end
313
-
314
- end
315
-
316
- describe "#app framework" do
317
-
318
- it "should return the instance of Rails when app framework is Rails" do
319
- application_with_rails.app_framework.should be_instance_of(InfinityTest::ApplicationLibrary::Rails)
320
- end
321
-
322
- it "should return the instance of Rubygems when app framework is Rubygems" do
323
- application_with_rubygems.app_framework.should be_instance_of(InfinityTest::ApplicationLibrary::RubyGems)
324
- end
325
-
326
- end
327
-
328
- describe '#using_test_unit?' do
329
-
330
- it "should return true when using Test::Unit" do
331
- app = application_with_test_unit
332
- app.using_test_unit?.should be_true
333
- end
334
-
335
- it "should return false when using Rspec" do
336
- app = application_with_rspec
337
- app.using_test_unit?.should be_false
338
- end
339
-
340
- end
341
-
342
- describe '#run_commands_for_file' do
343
-
344
- it "should run when have a file to run" do
345
- @application.test_framework.should_receive(:construct_commands).and_return('rvm 1.9.2 ruby -S rspec')
346
- @application.should_receive(:run!)
347
- @application.run_commands_for_file('file.rb')
348
- end
349
-
350
- it "should not run when file is nil" do
351
- @application.should_not_receive(:run!)
352
- @application.run_commands_for_file(nil)
353
- end
354
-
355
- it "should not run when file is empty string" do
356
- @application.should_not_receive(:run!)
357
- @application.run_commands_for_file('')
358
- end
359
-
360
- end
361
-
362
- describe '#files_to_run!' do
363
-
364
- it "should return all files when option Hash key is :all" do
365
- @application.files_to_run!(:all => 'spec_helper').should eql @application.all_test_files.join(' ')
366
- end
367
-
368
- it "should return all files when options symbol is :all" do
369
- @application.files_to_run!(:all => :files).should eql @application.all_test_files.join(' ')
370
- end
371
-
372
- it "should return the test file the matchs with changed logic file" do
373
- match_data = /(infinity_test\/heuristics)/.match('infinity_test/heuristics') #<MatchData "infinity_test/heuristics" 1:"infinity_test/heuristics">
374
- application_with_rspec.files_to_run!(:test_for => match_data).should include 'spec/infinity_test/heuristics_spec.rb'
375
- end
376
-
377
- it "should return the command with the test_loader" do
378
- app = application_with_test_unit
379
- app.should_receive(:all_test_files).and_return([ "lib/infinity_test/test_loader.rb", "test/people_test.rb"])
380
- match_data = /(people_test.rb)/.match('people_test.rb')
381
- app.files_to_run!(:test_for => match_data).should include "lib/infinity_test/test_unit_loader.rb"
382
- end
383
-
384
- it "should return the test file the match with the changed file" do
385
- match_data = /(infinity_test\/application)/.match('infinity_test/application') #<MatchData "infinity_test/application" 1:"infinity_test/application">
386
- application_with_rspec.files_to_run!(:test_for => match_data).should include 'spec/infinity_test/application_spec.rb'
387
- end
388
-
389
- it "should return the test file the matchs with the changed file when Test::Unit" do
390
- match_data = /(infinity_test\/application)/.match('infinity_test/application') #<MatchData "infinity_test/application" 1:"infinity_test/application">
391
- application_with_rspec.files_to_run!(:test_for => match_data).should include 'spec/infinity_test/application_spec.rb'
392
- end
393
-
394
- it "should return the test file the matchs with the changed file AND the dir specified" do
395
- @application.should_receive(:all_test_files).and_return(["spec/addressbook/people_spec.rb", "spec/people_spec.rb"])
396
- match_data = /(people_spec.rb)/.match('people_spec.rb')
397
- @application.files_to_run!(:test_for => match_data, :in_dir => 'spec/addressbook').should == "spec/addressbook/people_spec.rb"
398
- end
399
-
400
- it "should return all the tests files in the Dir specified" do
401
- @application.should_receive(:all_test_files).and_return(["spec/models/post_spec.rb", "spec/models/comment_spec.rb", "spec/people_spec.rb", "spec/controllers/posts_controller_spec.rb"])
402
- @application.files_to_run!(:all => :files, :in_dir => 'spec/models').should == "spec/models/post_spec.rb spec/models/comment_spec.rb"
403
- end
404
-
405
- it "should return all the tests files in the dir specified as a symbol" do
406
- @application.should_receive(:all_test_files).and_return(["spec/models/post_spec.rb", "spec/models/comment_spec.rb", "spec/people_spec.rb", "spec/controllers/posts_controller_spec.rb"])
407
- @application.files_to_run!(:all => :files, :in_dir => :models).should == "spec/models/post_spec.rb spec/models/comment_spec.rb"
408
- end
409
-
410
- it "should return all the test files in all dirs specified" do
411
- @application.should_receive(:all_test_files).and_return(['spec/models/post_spec.rb', 'spec/support/blueprints.rb', 'spec/controllers/comments_controller_spec.rb', 'spec/views/comments/index_spec.rb'])
412
- @application.files_to_run!(:all => :files, :in_dir => [:models, :controllers]).should == 'spec/models/post_spec.rb spec/controllers/comments_controller_spec.rb'
413
- end
414
-
415
- it "should return all the test files that match with file changed in the dirs specified" do
416
- @application.should_receive(:all_test_files).and_return(['spec/models/post_spec.rb', 'spec/controllers/post_controllers_spec.rb', 'spec/views/posts/index_spec.rb'])
417
- match_data = /(post)/.match('post')
418
- @application.files_to_run!(:test_for => match_data, :in_dir => [:models, :controllers]).should == 'spec/models/post_spec.rb spec/controllers/post_controllers_spec.rb'
419
- end
420
-
421
- end
422
-
423
- end
424
- end
@@ -1,72 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module InfinityTest
4
- describe BinaryPath do
5
- include BinaryPath
6
- before :all do
7
- @current = RVM::Environment.current
8
- end
9
-
10
- class Example
11
- include BinaryPath
12
- extend BinaryPath
13
- binary :bacon
14
- binary :cucumber
15
- binary :rspec, :name => :rspec_two
16
- binary :spec, :name => :rspec_one
17
- end
18
-
19
- describe '.binary' do
20
-
21
- before do
22
- @example = Example.new
23
- end
24
-
25
- it "should create the binary for bacon framework" do
26
- @current.should_receive(:path_for).with('bacon')
27
- @example.search_bacon(@current)
28
- end
29
-
30
- it "should create the binary for cucumber framework" do
31
- @current.should_receive(:path_for).with('cucumber')
32
- @example.search_cucumber(@current)
33
- end
34
-
35
- it "should create the binary for rspec two with sufix of rspec_two" do
36
- @current.should_receive(:path_for).with('rspec')
37
- @example.search_rspec_two(@current)
38
- end
39
-
40
- it "should create the binary for rspec one with sufix of rspec_one" do
41
- @current.should_receive(:path_for).with('spec')
42
- @example.search_rspec_one(@current)
43
- end
44
-
45
- end
46
-
47
- describe '#have_binary?' do
48
-
49
- it "should return true if the binary exists" do
50
- File.should_receive(:exist?).and_return(true)
51
- Example.new.have_binary?(:rspec).should be_true
52
- end
53
-
54
- it "should return false if the binary exists" do
55
- File.should_receive(:exist?).and_return(false)
56
- Example.new.have_binary?(:rspec).should be_false
57
- end
58
-
59
- end
60
-
61
- describe '#print_message' do
62
-
63
- it "should print the following message" do
64
- example = Example.new
65
- example.should_receive(:puts).with("\n Ruby => 1.9.2: I searched the rspec binary path and I don't find nothing. You have the rspec installed in this version?")
66
- example.print_message(:rspec, '1.9.2')
67
- end
68
-
69
- end
70
-
71
- end
72
- end
@@ -1,53 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module InfinityTest
4
- describe Command do
5
-
6
- it "should pass the ruby version and set" do
7
- Command.new(:ruby_version => '1.9.2').ruby_version.should == '1.9.2'
8
- end
9
-
10
- it "should pass the ruby version and set" do
11
- Command.new(:ruby_version => 'JRuby 1.3.5').ruby_version.should == 'JRuby 1.3.5'
12
- end
13
-
14
- it "should create and set the command" do
15
- Command.new(:command => 'rspec spec').command.should == 'rspec spec'
16
- end
17
-
18
- it "should create and set the command for ruby version" do
19
- Command.new(:command => 'spec spec').command.should == 'spec spec'
20
- end
21
-
22
- it "should have the results as Array" do
23
- Command.new.results.should be_instance_of(Array)
24
- end
25
-
26
- it "should have the line variable as Array" do
27
- Command.new.line.should be_instance_of(Array)
28
- end
29
-
30
- describe '#push_in_the_results' do
31
-
32
- before do
33
- @command = Command.new
34
- end
35
-
36
- it "should parse correct the results when have in the ree" do
37
- @command.line = [27, 91, 51, 51, 109, 49, 50, 49, 32, 101, 120, 97, 109, 112, 108, 101, 115, 44, 32, 48, 32, 102, 97, 105, 108, 117, 114, 101, 115, 44, 32, 50, 32, 112, 101, 110, 100, 105, 110, 103, 27, 91, 48, 109, 10]
38
- @command.should_receive(:yarv?).and_return(false)
39
- @command.push_in_the_results(?\n)
40
- @command.results.should == ["\e[33m121 examples, 0 failures, 2 pending\e[0m\n"]
41
- end
42
-
43
- it "should parse correct the results in ruby 1.8" do
44
- @command.line = [46, 46, 46, 46, 46, 42, 46, 42]
45
- @command.should_receive(:yarv?).and_return(false)
46
- @command.push_in_the_results(?\n)
47
- @command.results.should == [".....*.*"]
48
- end
49
-
50
- end
51
-
52
- end
53
- end