infinity_test 0.2.0 → 1.0.0

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 (72) hide show
  1. data/.gitignore +3 -0
  2. data/.infinity_test +30 -2
  3. data/.rspec +2 -0
  4. data/.rvmrc +1 -1
  5. data/Gemfile +10 -2
  6. data/Gemfile.lock +52 -12
  7. data/History.markdown +86 -2
  8. data/LICENSE.txt +22 -0
  9. data/Rakefile +25 -9
  10. data/Readme.markdown +47 -23
  11. data/TODO.markdown +12 -0
  12. data/Tasks +2 -3
  13. data/VERSION.yml +2 -2
  14. data/bin/infinity_test +1 -1
  15. data/features/heuristics.feature +23 -0
  16. data/features/support/env.rb +2 -0
  17. data/images/fuuu/failure.png +0 -0
  18. data/images/fuuu/pending.png +0 -0
  19. data/images/fuuu/sucess.png +0 -0
  20. data/infinity_test.gemspec +62 -29
  21. data/lib/infinity_test.rb +29 -9
  22. data/lib/infinity_test/application.rb +222 -68
  23. data/lib/infinity_test/application_library/rails.rb +94 -0
  24. data/lib/infinity_test/application_library/rubygems.rb +43 -0
  25. data/lib/infinity_test/binary_path.rb +30 -8
  26. data/lib/infinity_test/builder.rb +56 -0
  27. data/lib/infinity_test/command.rb +18 -24
  28. data/lib/infinity_test/configuration.rb +96 -44
  29. data/lib/infinity_test/continuous_testing.rb +17 -39
  30. data/lib/infinity_test/dependencies.rb +76 -41
  31. data/lib/infinity_test/environment.rb +15 -0
  32. data/lib/infinity_test/heuristics.rb +36 -0
  33. data/lib/infinity_test/heuristics_helper.rb +9 -0
  34. data/lib/infinity_test/options.rb +56 -19
  35. data/lib/infinity_test/runner.rb +25 -17
  36. data/lib/infinity_test/test_framework.rb +109 -0
  37. data/lib/infinity_test/test_library/bacon.rb +55 -0
  38. data/lib/infinity_test/test_library/cucumber.rb +22 -0
  39. data/lib/infinity_test/test_library/rspec.rb +58 -0
  40. data/lib/infinity_test/test_library/test_unit.rb +46 -0
  41. data/spec/factories/company/Gemfile +0 -0
  42. data/spec/factories/infinity_test_example +2 -2
  43. data/spec/infinity_test/application_library/rails_spec.rb +140 -0
  44. data/spec/infinity_test/application_library/rubygems_spec.rb +52 -0
  45. data/spec/infinity_test/application_spec.rb +274 -50
  46. data/spec/infinity_test/binary_path_spec.rb +72 -0
  47. data/spec/infinity_test/builder_spec.rb +7 -0
  48. data/spec/infinity_test/command_spec.rb +13 -14
  49. data/spec/infinity_test/configuration_spec.rb +183 -57
  50. data/spec/infinity_test/continuous_testing_spec.rb +19 -1
  51. data/spec/infinity_test/environment_spec.rb +23 -0
  52. data/spec/infinity_test/heuristics_helper_spec.rb +15 -0
  53. data/spec/infinity_test/heuristics_spec.rb +127 -0
  54. data/spec/infinity_test/options_spec.rb +48 -26
  55. data/spec/infinity_test/runner_spec.rb +37 -29
  56. data/spec/infinity_test/test_framework_spec.rb +127 -0
  57. data/spec/infinity_test/test_library/bacon_spec.rb +150 -0
  58. data/spec/infinity_test/test_library/cucumber_spec.rb +8 -0
  59. data/spec/infinity_test/test_library/rspec_spec.rb +185 -0
  60. data/spec/infinity_test/test_library/test_unit_spec.rb +184 -0
  61. data/spec/infinity_test_spec.rb +23 -12
  62. data/spec/spec_helper.rb +86 -30
  63. metadata +62 -32
  64. data/lib/infinity_test/notifications/growl.rb +0 -15
  65. data/lib/infinity_test/notifications/lib_notify.rb +0 -11
  66. data/lib/infinity_test/rspec.rb +0 -87
  67. data/lib/infinity_test/test_unit.rb +0 -74
  68. data/spec/infinity_test/notifications/growl_spec.rb +0 -9
  69. data/spec/infinity_test/notifications/lib_notify_spec.rb +0 -9
  70. data/spec/infinity_test/rspec_spec.rb +0 -189
  71. data/spec/infinity_test/test_unit_spec.rb +0 -182
  72. data/spec/spec.opts +0 -1
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  *.sw?
2
+ coverage
2
3
  .DS_STORE
3
4
  .DS_Store
4
5
  log*
@@ -8,3 +9,5 @@ tmp/*
8
9
  rerun.txt
9
10
  .bundle/*
10
11
  *.rbc
12
+ *~
13
+ bin/*.rbc
@@ -2,7 +2,35 @@
2
2
 
3
3
  infinity_test do
4
4
 
5
- use :rubies => ['1.8.7', '1.9.2', 'jruby', 'ree'], :gemset => 'infinity_test', :test_framework => :rspec
5
+ use :rubies => ['1.8.7', '1.9.2', 'jruby', 'ree', 'rbx'], :gemset => 'infinity_test', :test_framework => :rspec
6
6
 
7
- end
7
+ heuristics do
8
+ add '^lib/infinity_test/dependencies.rb' do |file|
9
+ run :all => :files
10
+ end
11
+ end
12
+
13
+ after(:all) do
14
+ system('rake clean_without_verbose')
15
+ end
8
16
 
17
+ # heuristics do
18
+ #
19
+ # add :dir => 'app/models' do |file|
20
+ # run_test :for => file
21
+ # end
22
+ #
23
+ # add %r%^(test|spec)/fixtures/(.*).yml$% do |file|
24
+ # run_test :for => file, :in_dir => "test"
25
+ # end
26
+ #
27
+ # application_library.watch :dir => 'app/models' do |file|
28
+ # run :test => "spec/models/"
29
+ # end
30
+ #
31
+ # watch(%r%^(test|spec)/fixtures/(.*).yml$%) do |m|
32
+ # "test/test_#{m[1]}.rb"
33
+ # end
34
+ # end
35
+
36
+ end
data/.rspec CHANGED
@@ -1 +1,3 @@
1
1
  --color
2
+ --autotest
3
+ --require fuubar --format Fuubar
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm 1.9.2
1
+ rvm --create 1.9.2@infinity_test
data/Gemfile CHANGED
@@ -2,8 +2,16 @@
2
2
 
3
3
  source :rubygems
4
4
 
5
- gem 'watchr'
5
+ gem 'watchr', '0.7'
6
+ gem 'notifiers', '1.1.0'
6
7
 
7
8
  group :test do
8
- gem 'rspec', ">= 2.0.0.beta.20"
9
+ gem 'rspec', ">= 2.1.0"
10
+ gem 'cucumber', '0.9.0'
11
+ gem 'aruba', '0.2.1'
12
+ gem 'fuubar'
9
13
  end
14
+
15
+ group :development do
16
+ gem 'jeweler'
17
+ end
@@ -1,22 +1,62 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ aruba (0.2.1)
5
+ builder (2.1.2)
6
+ cucumber (0.9.0)
7
+ builder (~> 2.1.2)
8
+ diff-lcs (~> 1.1.2)
9
+ gherkin (~> 2.2.2)
10
+ json (~> 1.4.6)
11
+ term-ansicolor (~> 1.0.5)
4
12
  diff-lcs (1.1.2)
5
- rspec (2.0.0.beta.22)
6
- rspec-core (= 2.0.0.beta.22)
7
- rspec-expectations (= 2.0.0.beta.22)
8
- rspec-mocks (= 2.0.0.beta.22)
9
- rspec-core (2.0.0.beta.22)
10
- rspec-expectations (2.0.0.beta.22)
11
- diff-lcs (>= 1.1.2)
12
- rspec-mocks (2.0.0.beta.22)
13
- rspec-core (= 2.0.0.beta.22)
14
- rspec-expectations (= 2.0.0.beta.22)
13
+ fuubar (0.0.1)
14
+ progressbar (~> 0.9)
15
+ rspec (~> 2.0)
16
+ rspec-instafail (~> 0.1)
17
+ gemcutter (0.6.1)
18
+ gherkin (2.2.4)
19
+ json (~> 1.4.6)
20
+ term-ansicolor (~> 1.0.5)
21
+ trollop (~> 1.16.2)
22
+ gherkin (2.2.4-java)
23
+ json (~> 1.4.6)
24
+ term-ansicolor (~> 1.0.5)
25
+ trollop (~> 1.16.2)
26
+ git (1.2.5)
27
+ jeweler (1.4.0)
28
+ gemcutter (>= 0.1.0)
29
+ git (>= 1.2.5)
30
+ rubyforge (>= 2.0.0)
31
+ json (1.4.6)
32
+ json (1.4.6-java)
33
+ json_pure (1.4.6)
34
+ notifiers (1.1.0)
35
+ progressbar (0.9.0)
36
+ rspec (2.1.0)
37
+ rspec-core (~> 2.1.0)
38
+ rspec-expectations (~> 2.1.0)
39
+ rspec-mocks (~> 2.1.0)
40
+ rspec-core (2.1.0)
41
+ rspec-expectations (2.1.0)
42
+ diff-lcs (~> 1.1.2)
43
+ rspec-instafail (0.1.2)
44
+ rspec-mocks (2.1.0)
45
+ rubyforge (2.0.4)
46
+ json_pure (>= 1.1.7)
47
+ term-ansicolor (1.0.5)
48
+ trollop (1.16.2)
15
49
  watchr (0.7)
16
50
 
17
51
  PLATFORMS
52
+ java
18
53
  ruby
19
54
 
20
55
  DEPENDENCIES
21
- rspec (>= 2.0.0.beta.20)
22
- watchr
56
+ aruba (= 0.2.1)
57
+ cucumber (= 0.9.0)
58
+ fuubar
59
+ jeweler
60
+ notifiers (= 1.1.0)
61
+ rspec (>= 2.1.0)
62
+ watchr (= 0.7)
@@ -1,4 +1,87 @@
1
- Master Branch (in development)
1
+ v1.0.0
2
+ ==============
3
+
4
+ Features
5
+ --------
6
+
7
+ - Added the RVM System Wide support (For more information see http://rvm.beginrescueend.com/deployment/system-wide/ )
8
+
9
+ - Added the Heuristics feature(<b>For users who want to add your own paths</b>)
10
+ This example tell to InfinityTest <b>run all the tests when some_file.rb is changed</b>
11
+ This basic DSL you will put in the <b>infinity_test file</b>:
12
+
13
+ heuristics do
14
+ add('some_file.rb') do |file|
15
+ run :all => :tests
16
+ end
17
+ end
18
+
19
+ If you want run only the similar test file you can do too:
20
+
21
+ heuristics do
22
+ add('some_file.rb') do |file|
23
+ run :test_for => file
24
+ end
25
+ end
26
+
27
+ If you want run only the similar test in some dir, you can do too:
28
+
29
+ heuristics do
30
+ add('some_file.rb') do |file|
31
+ run :test_for => file, :in_dir => :models
32
+ end
33
+ end
34
+
35
+ If you want run all tests in a particular dir, you can do too:
36
+
37
+ heuristics do
38
+ add('some_file.rb') do |file|
39
+ run :all => :tests, :in_dir => :controllers
40
+ end
41
+ end
42
+
43
+ You can pass an array of dirs too (w00t!!):
44
+
45
+ heuristics do
46
+ add('some_file.rb') do |file|
47
+ run :all => :tests, :in_dir => [:controllers, :models]
48
+ end
49
+ end
50
+
51
+ - Support Bundler:
52
+ The InfinityTest try to discover If the user have a Gemfile in the project root and
53
+ if Gemfile exists InfinityTest will run with "bundle exec #{command}" else will run "command" normally.
54
+
55
+ Obs.: <b>In any case, you don't want this "magic" just run infinity_test with --skip-bundler flag.
56
+ Or write this in .infinity_test file:</b>
57
+
58
+ # ~/.infinity_test or ./.infinity_test
59
+ infinity_test do
60
+ skip_bundler!
61
+ end
62
+
63
+ - Support Bacon - for more information see - http://github.com/chneukirchen/bacon (thanks to Ng Tze Yang)
64
+ If you want run with Bacon just run with --bacon flag or add :test_framework => :bacon to infinity_test file
65
+
66
+ - Possible to setup the lib pattern, test pattern (thanks to Jason Rogers).
67
+
68
+ # ~/.infinity_test or ./.infinity_test
69
+ infinity_test do
70
+ before_env do |application|
71
+ application.test_framework.test_directory_pattern = "^my_unusual_spec_directory/unit/(.*)_spec.rb"
72
+ application.test_framework.test_pattern = "my_unusual_spec_directory/unit/*_spec.rb"
73
+ application.library_directory_pattern = '^my_unusual_lib_directory/*/(.*).rb'
74
+ end
75
+ end
76
+
77
+ OBS.: <b>The #before_env methods is an alias to #replace_patterns method</b>
78
+
79
+ Refactoring
80
+ -----------
81
+
82
+ - Refactoring all the tests frameworks to become more easier to add a new test library
83
+
84
+ v0.2.0
2
85
  ==============================
3
86
 
4
87
  Features
@@ -13,6 +96,7 @@ Features
13
96
  before(:each_ruby) do |environment|
14
97
  environment.ruby('some_ruby_file') # run a ruby file in each ruby that you setup
15
98
  environment.rake('Rakefile', 'compile') # run rake compile in each ruby that you setup
99
+ environment.system('rake compile') # or with system command
16
100
  end
17
101
 
18
102
  after(:each_ruby) do |environment|
@@ -41,4 +125,4 @@ v0.1.0
41
125
  * Put some images to show in the notifications.
42
126
  * Create the hooks in before all the test and after all tests.
43
127
  * Create the notifications DSL for the .infinity_test file.
44
- * Possible to run with Test::Unit or Rspec with RVM.
128
+ * Possible to run with Test::Unit or Rspec with RVM.
@@ -0,0 +1,22 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010 Tomás D'Stefano
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -2,6 +2,14 @@
2
2
  require 'rubygems'
3
3
  require 'rake'
4
4
 
5
+ require 'rake/clean'
6
+ CLEAN.include('lib/*rbc','lib/*/*.rbc', 'spec/*.rbc', 'spec/*/*.rbc', 'lib/*/*/*rbc', 'spec/*/*/*rbc')
7
+
8
+ task :clean_without_verbose do
9
+ verbose(false)
10
+ Rake::Task['clean'].invoke
11
+ end
12
+
5
13
  $:.unshift(File.dirname(__FILE__) + '/lib')
6
14
 
7
15
  POST_MESSAGE = <<-POST_INSTALL_MESSAGE
@@ -9,17 +17,17 @@ POST_MESSAGE = <<-POST_INSTALL_MESSAGE
9
17
  #{ '-' * 80}
10
18
  T O I N F I N I T Y A N D B E Y O N D !!!
11
19
 
12
- The Infinity uses the awesome RVM to run.
20
+ The Infinity uses the awesome RVM to run.
13
21
  If you don't have the RVM installed, stop what you doing =p.
14
22
  RVM Installation Instructions:
15
- http://rvm.beginrescueend.com/rvm/install/
16
- And don't forget to see how you can customize Infinity Test here:
23
+ http://rvm.beginrescueend.com/rvm/install/
24
+ And don't forget to see how you can customize Infinity Test here:
17
25
  http://github.com/tomas-stefano/infinity_test/wiki/Customize-Infinity-Test
18
26
 
19
27
  Happy Coding! :)
20
28
 
21
29
  #{ '-' * 80}
22
-
30
+
23
31
  POST_INSTALL_MESSAGE
24
32
 
25
33
  begin
@@ -27,17 +35,17 @@ begin
27
35
  Jeweler::Tasks.new do |gemspec|
28
36
  gemspec.name = "infinity_test"
29
37
  gemspec.summary = "Continuous testing and a flexible alternative to Autotest using watchr and RVM"
30
- gemspec.description = "Infinity Test is a continuous testing library and a flexible alternative to Autotest, using Watchr library with Rspec OR Test::Unit with RVM funcionality, giving the possibility to test with all Rubies that you have in your RVM configuration."
38
+ gemspec.description = "Infinity Test is a continuous testing library and a flexible alternative to Autotest, using Watchr library with Rspec, Test::Unit or Bacon with RVM funcionality, giving the possibility to test with all Rubies that you have in your RVM configuration."
31
39
  gemspec.email = "tomasdestefi@gmail.com"
32
40
  gemspec.homepage = "http://github.com/tomas-stefano/infinity_test"
33
41
  gemspec.authors = ["Tomas D'Stefano"]
34
42
 
35
43
  gemspec.add_dependency('watchr', '>= 0.7')
44
+ gemspec.add_dependency('notifiers', '>= 1.1.0')
45
+
46
+ gemspec.add_development_dependency('rspec', '>= 2.0.1')
47
+ gemspec.add_development_dependency('jeweler', '>= 1.4.0')
36
48
 
37
- gemspec.add_development_dependency('rspec', '>= 1.3.0')
38
- gemspec.add_development_dependency('cucumber', '>= 0.6.2')
39
- gemspec.add_development_dependency('aruba', '>= 0.1.7')
40
-
41
49
  gemspec.post_install_message = POST_MESSAGE
42
50
  end
43
51
  Jeweler::GemcutterTasks.new
@@ -47,3 +55,11 @@ rescue LoadError
47
55
  [sudo] gem install jeweler"
48
56
  puts("-" * 80)
49
57
  end
58
+
59
+
60
+ require 'rspec/core/rake_task'
61
+ RSpec::Core::RakeTask.new("spec") do |t|
62
+ t.pattern = "./spec/infinity_test/**/*_spec.rb"
63
+ end
64
+
65
+ task :default => :spec
@@ -1,8 +1,8 @@
1
1
  # Infinity Test
2
2
 
3
3
 
4
- Infinity Test is a continuous testing library and a flexible alternative to Autotest,
5
- using Watchr library with Rspec OR Test::Unit with RVM funcionality,
4
+ Infinity Test is a continuous testing library and a flexible alternative to Autotest,
5
+ using the awesome Watchr library with Rspec, Test::Unit, Bacon and with RVM funcionality,
6
6
  giving the possibility to test with all <b>Rubies</b> that you have in your RVM configuration.
7
7
 
8
8
  ## To Infinity and Beyond!
@@ -24,7 +24,11 @@ With Rspec:
24
24
 
25
25
  With Test::Unit:
26
26
 
27
- infinity_test --test-unit
27
+ infinity_test --test-unit
28
+
29
+ With Bacon:
30
+
31
+ infinity_test --bacon
28
32
 
29
33
  ## Running Tests with many Rubies
30
34
 
@@ -36,8 +40,18 @@ Or with Test::Unit:
36
40
 
37
41
  infinity_test --test-unit --rubies=1.8.7,jruby,ree,1.9.2
38
42
 
43
+ Or with bacon:
44
+
45
+ infinity_test --bacon --rubies=1.8.7,ree,1.9.2
46
+
39
47
  <b>And you are ready to Test with all ruby versions your Rspec or Test::Unit Suite with Autotest-like Behavior.</b>
40
48
 
49
+ ## Running Tests with Rails (only in master branch!)
50
+
51
+ With Rails:
52
+
53
+ infinity_test --rails
54
+
41
55
  ## Configuration file
42
56
 
43
57
  ### Simple Domain Specific Language for Infinity Test file
@@ -50,27 +64,42 @@ So create the global file or project file called:
50
64
  ~/.infinity_test or .infinity_test
51
65
 
52
66
  infinity_test do
53
-
54
- notifications :growl do
55
- show_images :mode => :mario_bros
56
- end
57
-
58
- use :rubies => %w(1.9.1 jruby 1.9.2 ree), :test_framework => :rspec
59
-
60
- before_run do
61
- clear :terminal
62
- end
63
-
64
- after_run do
65
- ... some code
66
- end
67
-
67
+
68
+ notifications :growl do
69
+ show_images :mode => :mario_bros
70
+ end
71
+
72
+ use :rubies => %w(1.9.1 jruby 1.9.2 ree), :test_framework => :rspec
73
+
74
+ before(:each_ruby) do |environment|
75
+ # ...
76
+ end
77
+
78
+ after(:each_ruby) do |environment|
79
+ # ...
80
+ end
81
+
82
+ before_run do
83
+ clear :terminal
84
+ end
85
+
86
+ after_run do
87
+ # ...
88
+ end
89
+
68
90
  end
69
91
 
70
92
  ## Customize the .infinity_test file
71
93
 
72
94
  #### If you want to customize and understand the .infinity_test file, <a href='http://github.com/tomas-stefano/infinity_test/wiki/Customize-Infinity-Test'>Read this Page</a>
73
95
 
96
+ # Color in RSpec
97
+
98
+ ### Put this in your <b>.rspec</b> file:
99
+
100
+ --color
101
+ --autotest
102
+
74
103
  ## You Like it the Idea?
75
104
 
76
105
  <b>So make a fork and start contributing =].</b>
@@ -79,11 +108,6 @@ So create the global file or project file called:
79
108
 
80
109
  <b>Contact me in Github and let's talk! =] </b>
81
110
 
82
- ## TODO
83
-
84
- * Working in focus files and run only the modified file (Strategies for Test::Unit, Rspec and Cucumber)
85
- * Working in support Rails applications (Sinatra/Rack/Padrino too!)
86
-
87
111
  # Acknowledgments
88
112
 
89
113
  * Thanks to Mynyml and Watchr library.