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 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
@@ -87,6 +87,14 @@ So create the global file or project file called:
87
87
  # ...
88
88
  end
89
89
 
90
+ heuristics('my_pattern') do |file|
91
+ # ...
92
+ end
93
+
94
+ replace_patterns do |application|
95
+ # ...
96
+ end
97
+
90
98
  end
91
99
 
92
100
  ## Customize the .infinity_test file
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 0
4
- :patch: 0
4
+ :patch: 1
5
5
  :build:
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{infinity_test}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tomas D'Stefano"]
@@ -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
- return options.to_s if options.is_a?(MatchData)
254
- if options.equal?(:all) or options.include?(:all)
255
- search_files_in_dir(all_test_files, :in_dir => options[:in_dir]).join(' ')
256
- else
257
- search_file(:pattern => options[:test_for][1], :in_dir => options[:in_dir]) if options.include?(:test_for)
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]
@@ -25,6 +25,12 @@ module InfinityTest
25
25
  def test_files
26
26
  super.split.unshift(test_loader).sort.join(' ')
27
27
  end
28
+
29
+ def decide_files(file)
30
+ return file if file
31
+ test_files
32
+ end
33
+
28
34
 
29
35
  def test_loader
30
36
  $LOAD_PATH.each do |path|
@@ -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 eql ["test/company_test.rb"]
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
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tomas D'Stefano