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