infinity_test 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.markdown +7 -0
- data/Readme.markdown +8 -0
- data/VERSION.yml +1 -1
- data/infinity_test.gemspec +1 -1
- data/lib/infinity_test/application.rb +12 -6
- data/lib/infinity_test/builder.rb +11 -0
- data/lib/infinity_test/test_library/test_unit.rb +6 -0
- data/spec/infinity_test/application_spec.rb +7 -0
- data/spec/infinity_test/test_library/test_unit_spec.rb +2 -2
- metadata +2 -2
data/History.markdown
CHANGED
@@ -4,9 +4,16 @@ v1.0.0
|
|
4
4
|
Features
|
5
5
|
--------
|
6
6
|
|
7
|
+
- Added the <b>Fuu</b> images: <a href="https://github.com/tomas-stefano/infinity_test/tree/master/images/fuuu/">https://github.com/tomas-stefano/infinity_test/tree/master/images/fuuu/</a> (thanks to Marcio Giaxia)
|
8
|
+
|
7
9
|
- Added the RVM System Wide support (For more information see http://rvm.beginrescueend.com/deployment/system-wide/ )
|
8
10
|
|
9
11
|
- Added the Heuristics feature(<b>For users who want to add your own paths</b>)
|
12
|
+
|
13
|
+
To see the Heuristics that InfinityTest will see type in ther terminal:
|
14
|
+
|
15
|
+
infinity_test --heuristics
|
16
|
+
|
10
17
|
This example tell to InfinityTest <b>run all the tests when some_file.rb is changed</b>
|
11
18
|
This basic DSL you will put in the <b>infinity_test file</b>:
|
12
19
|
|
data/Readme.markdown
CHANGED
data/VERSION.yml
CHANGED
data/infinity_test.gemspec
CHANGED
@@ -250,12 +250,18 @@ module InfinityTest
|
|
250
250
|
# files_to_run!(match_data) # => return the test file
|
251
251
|
#
|
252
252
|
def files_to_run!(options)
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
253
|
+
files = lambda do
|
254
|
+
options.to_s if options.is_a?(MatchData)
|
255
|
+
if options.equal?(:all) or options.include?(:all)
|
256
|
+
search_files_in_dir(all_test_files, :in_dir => options[:in_dir]).join(' ')
|
257
|
+
else
|
258
|
+
search_file(:pattern => options[:test_for][1], :in_dir => options[:in_dir]) if options.include?(:test_for)
|
259
|
+
end
|
258
260
|
end
|
261
|
+
files = files.call
|
262
|
+
# Fix fo Test::Unit - But this is not responsability of the Application instances - Refactoring this
|
263
|
+
files = "#{test_framework.test_loader} #{files}" if test_framework.respond_to?(:test_loader)
|
264
|
+
files
|
259
265
|
end
|
260
266
|
|
261
267
|
# Search files under the dir(s) specified
|
@@ -271,7 +277,7 @@ module InfinityTest
|
|
271
277
|
# Search files that matches with the pattern
|
272
278
|
#
|
273
279
|
def search_file(options)
|
274
|
-
files = all_test_files.grep(/#{options[:pattern]}/i)
|
280
|
+
files = all_test_files.grep(/#{options[:pattern]}/i)
|
275
281
|
search_files_in_dir(files, :in_dir => options[:in_dir]).join(' ')
|
276
282
|
end
|
277
283
|
|
@@ -1,19 +1,26 @@
|
|
1
1
|
module InfinityTest
|
2
2
|
module Builder
|
3
3
|
|
4
|
+
#
|
5
|
+
# TODO: Refactoring this Ugly Code
|
6
|
+
#
|
4
7
|
#
|
5
8
|
def construct_command(options)
|
6
9
|
binary_name, ruby_version, command, file, environment = resolve_options(options)
|
10
|
+
|
7
11
|
unless have_binary?(binary_name) || options[:skip_binary?]
|
8
12
|
print_message(binary_name, ruby_version)
|
13
|
+
|
9
14
|
else
|
10
15
|
command = "#{command} #{decide_files(file)}"
|
11
16
|
rvm_ruby_version = "rvm #{ruby_version} ruby"
|
17
|
+
|
12
18
|
if application.have_gemfile? and not application.skip_bundler?
|
13
19
|
run_with_bundler!(rvm_ruby_version, command, environment)
|
14
20
|
else
|
15
21
|
run_without_bundler!(rvm_ruby_version, command)
|
16
22
|
end
|
23
|
+
|
17
24
|
end
|
18
25
|
end
|
19
26
|
|
@@ -42,6 +49,10 @@ module InfinityTest
|
|
42
49
|
construct_rubies_commands(file)
|
43
50
|
end
|
44
51
|
|
52
|
+
#
|
53
|
+
# TODO: Refactoring this Ugly Code
|
54
|
+
#
|
55
|
+
#
|
45
56
|
def resolve_options(options)
|
46
57
|
ruby_version = options[:for]
|
47
58
|
binary_name = options[:skip_binary?] ? '' : options[:binary]
|
@@ -373,6 +373,13 @@ module InfinityTest
|
|
373
373
|
match_data = /(infinity_test\/heuristics)/.match('infinity_test/heuristics') #<MatchData "infinity_test/heuristics" 1:"infinity_test/heuristics">
|
374
374
|
application_with_rspec.files_to_run!(:test_for => match_data).should include 'spec/infinity_test/heuristics_spec.rb'
|
375
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
|
376
383
|
|
377
384
|
it "should return the test file the match with the changed file" do
|
378
385
|
match_data = /(infinity_test\/application)/.match('infinity_test/application') #<MatchData "infinity_test/application" 1:"infinity_test/application">
|
@@ -32,13 +32,13 @@ module InfinityTest
|
|
32
32
|
|
33
33
|
it "return should include test/company_test.rb" do
|
34
34
|
Dir.chdir("#{@current_dir}/spec/factories/company") do
|
35
|
-
test_unit.all_files.should
|
35
|
+
test_unit.all_files.should include "test/company_test.rb"
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
it "return should include more than one file to test" do
|
40
40
|
Dir.chdir("#{@current_dir}/spec/factories/travel") do
|
41
|
-
test_unit.all_files.should eql ["test/partner_test.rb","test/travel_test.rb"]
|
41
|
+
files = test_unit.all_files.should eql ["test/partner_test.rb", "test/travel_test.rb"]
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|