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.
- data/.gitignore +3 -0
- data/.infinity_test +30 -2
- data/.rspec +2 -0
- data/.rvmrc +1 -1
- data/Gemfile +10 -2
- data/Gemfile.lock +52 -12
- data/History.markdown +86 -2
- data/LICENSE.txt +22 -0
- data/Rakefile +25 -9
- data/Readme.markdown +47 -23
- data/TODO.markdown +12 -0
- data/Tasks +2 -3
- data/VERSION.yml +2 -2
- data/bin/infinity_test +1 -1
- data/features/heuristics.feature +23 -0
- data/features/support/env.rb +2 -0
- data/images/fuuu/failure.png +0 -0
- data/images/fuuu/pending.png +0 -0
- data/images/fuuu/sucess.png +0 -0
- data/infinity_test.gemspec +62 -29
- data/lib/infinity_test.rb +29 -9
- data/lib/infinity_test/application.rb +222 -68
- data/lib/infinity_test/application_library/rails.rb +94 -0
- data/lib/infinity_test/application_library/rubygems.rb +43 -0
- data/lib/infinity_test/binary_path.rb +30 -8
- data/lib/infinity_test/builder.rb +56 -0
- data/lib/infinity_test/command.rb +18 -24
- data/lib/infinity_test/configuration.rb +96 -44
- data/lib/infinity_test/continuous_testing.rb +17 -39
- data/lib/infinity_test/dependencies.rb +76 -41
- data/lib/infinity_test/environment.rb +15 -0
- data/lib/infinity_test/heuristics.rb +36 -0
- data/lib/infinity_test/heuristics_helper.rb +9 -0
- data/lib/infinity_test/options.rb +56 -19
- data/lib/infinity_test/runner.rb +25 -17
- data/lib/infinity_test/test_framework.rb +109 -0
- data/lib/infinity_test/test_library/bacon.rb +55 -0
- data/lib/infinity_test/test_library/cucumber.rb +22 -0
- data/lib/infinity_test/test_library/rspec.rb +58 -0
- data/lib/infinity_test/test_library/test_unit.rb +46 -0
- data/spec/factories/company/Gemfile +0 -0
- data/spec/factories/infinity_test_example +2 -2
- data/spec/infinity_test/application_library/rails_spec.rb +140 -0
- data/spec/infinity_test/application_library/rubygems_spec.rb +52 -0
- data/spec/infinity_test/application_spec.rb +274 -50
- data/spec/infinity_test/binary_path_spec.rb +72 -0
- data/spec/infinity_test/builder_spec.rb +7 -0
- data/spec/infinity_test/command_spec.rb +13 -14
- data/spec/infinity_test/configuration_spec.rb +183 -57
- data/spec/infinity_test/continuous_testing_spec.rb +19 -1
- data/spec/infinity_test/environment_spec.rb +23 -0
- data/spec/infinity_test/heuristics_helper_spec.rb +15 -0
- data/spec/infinity_test/heuristics_spec.rb +127 -0
- data/spec/infinity_test/options_spec.rb +48 -26
- data/spec/infinity_test/runner_spec.rb +37 -29
- data/spec/infinity_test/test_framework_spec.rb +127 -0
- data/spec/infinity_test/test_library/bacon_spec.rb +150 -0
- data/spec/infinity_test/test_library/cucumber_spec.rb +8 -0
- data/spec/infinity_test/test_library/rspec_spec.rb +185 -0
- data/spec/infinity_test/test_library/test_unit_spec.rb +184 -0
- data/spec/infinity_test_spec.rb +23 -12
- data/spec/spec_helper.rb +86 -30
- metadata +62 -32
- data/lib/infinity_test/notifications/growl.rb +0 -15
- data/lib/infinity_test/notifications/lib_notify.rb +0 -11
- data/lib/infinity_test/rspec.rb +0 -87
- data/lib/infinity_test/test_unit.rb +0 -74
- data/spec/infinity_test/notifications/growl_spec.rb +0 -9
- data/spec/infinity_test/notifications/lib_notify_spec.rb +0 -9
- data/spec/infinity_test/rspec_spec.rb +0 -189
- data/spec/infinity_test/test_unit_spec.rb +0 -182
- data/spec/spec.opts +0 -1
@@ -0,0 +1,94 @@
|
|
1
|
+
module InfinityTest
|
2
|
+
module ApplicationLibrary
|
3
|
+
class Rails
|
4
|
+
include HeuristicsHelper
|
5
|
+
attr_accessor :lib_pattern,
|
6
|
+
:test_pattern,
|
7
|
+
:configuration_pattern,
|
8
|
+
:routes_pattern,
|
9
|
+
:fixtures_pattern,
|
10
|
+
:controllers_pattern,
|
11
|
+
:models_pattern,
|
12
|
+
:helpers_pattern,
|
13
|
+
:mailers_pattern,
|
14
|
+
:application_controller_pattern,
|
15
|
+
:application_helper_pattern
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@application = InfinityTest.application
|
19
|
+
resolve_patterns!
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_heuristics!
|
23
|
+
rails = self
|
24
|
+
heuristics do
|
25
|
+
|
26
|
+
add(rails.application_controller_pattern) do |file|
|
27
|
+
run :all => :tests, :in_dir => :controllers
|
28
|
+
end
|
29
|
+
|
30
|
+
add(rails.application_helper_pattern) do |file|
|
31
|
+
run :all => :tests, :in_dir => [:helpers, :views]
|
32
|
+
end
|
33
|
+
|
34
|
+
add(rails.configuration_pattern) do |file|
|
35
|
+
run(:all => :tests)
|
36
|
+
end
|
37
|
+
|
38
|
+
add(rails.routes_pattern) do |file|
|
39
|
+
run(:all => :tests)
|
40
|
+
end
|
41
|
+
|
42
|
+
add(rails.controllers_pattern) do |file|
|
43
|
+
run :test_for => file, :in_dir => :controllers
|
44
|
+
end
|
45
|
+
|
46
|
+
add(rails.models_pattern) do |file|
|
47
|
+
run :test_for => file, :in_dir => :models
|
48
|
+
end
|
49
|
+
|
50
|
+
add(rails.helpers_pattern) do |file|
|
51
|
+
run :test_for => file, :in_dir => :helpers
|
52
|
+
end
|
53
|
+
|
54
|
+
add(rails.mailers_pattern) do |file|
|
55
|
+
run :test_for => file, :in_dir => :mailers
|
56
|
+
end
|
57
|
+
|
58
|
+
add(rails.lib_pattern) do |file|
|
59
|
+
run :test_for => file, :in_dir => :lib
|
60
|
+
end
|
61
|
+
|
62
|
+
add(rails.test_pattern) do |file|
|
63
|
+
run file
|
64
|
+
end
|
65
|
+
|
66
|
+
add(rails.fixtures_pattern) do |file|
|
67
|
+
run :all => :tests, :in_dir => :models
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def resolve_patterns!
|
74
|
+
@configuration_pattern = "^config/application.rb"
|
75
|
+
@routes_pattern = "^config/routes\.rb"
|
76
|
+
@lib_pattern = "^lib/*/(.*)\.rb"
|
77
|
+
if @application.using_test_unit?
|
78
|
+
@test_pattern = "^test/*/(.*)_test.rb"
|
79
|
+
@fixtures_pattern = "^test/fixtures/(.*).yml"
|
80
|
+
else
|
81
|
+
@test_pattern = "^spec/*/(.*)_spec.rb"
|
82
|
+
@fixtures_pattern = "^spec/fixtures/(.*).yml"
|
83
|
+
end
|
84
|
+
@controllers_pattern = "^app/controllers/(.*)\.rb"
|
85
|
+
@models_pattern = "^app/models/(.*)\.rb"
|
86
|
+
@helpers_pattern = "^app/helpers/(.*)\.rb"
|
87
|
+
@mailers_pattern = "^app/mailers/(.*)\.rb"
|
88
|
+
@application_controller_pattern = "^app/controllers/application_controller.rb"
|
89
|
+
@application_helper_pattern = "^app/helpers/application_helper.rb"
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module InfinityTest
|
2
|
+
module ApplicationLibrary
|
3
|
+
class RubyGems
|
4
|
+
include HeuristicsHelper
|
5
|
+
attr_accessor :lib_pattern, :test_pattern, :application, :test_helper_pattern
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@application = InfinityTest.application
|
9
|
+
@lib_pattern = "^lib/*/(.*)\.rb"
|
10
|
+
if @application.using_test_unit?
|
11
|
+
@test_pattern = "^test/*/(.*)_test.rb"
|
12
|
+
@test_helper_pattern = "^test/*/test_helper.rb"
|
13
|
+
else
|
14
|
+
@test_pattern = "^spec/*/(.*)_spec.rb"
|
15
|
+
@test_helper_pattern = "^spec/*/spec_helper.rb"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Add Heuristics to send to Watchr Methods
|
20
|
+
# This methods aren't tested!
|
21
|
+
#
|
22
|
+
def add_heuristics!
|
23
|
+
rubygems = self
|
24
|
+
heuristics do
|
25
|
+
|
26
|
+
add(rubygems.lib_pattern) do |file|
|
27
|
+
run :test_for => file
|
28
|
+
end
|
29
|
+
|
30
|
+
add(rubygems.test_pattern) do |file|
|
31
|
+
run file
|
32
|
+
end
|
33
|
+
|
34
|
+
add(rubygems.test_helper_pattern) do |file|
|
35
|
+
run :all => :tests
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,21 +1,43 @@
|
|
1
1
|
module InfinityTest
|
2
2
|
module BinaryPath
|
3
|
-
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.extend ClassMethods
|
6
|
+
base.send :include, ClassMethods
|
7
|
+
end
|
8
|
+
|
4
9
|
def rvm_bin_path(environment, binary)
|
5
|
-
|
10
|
+
environment.path_for(binary)
|
6
11
|
end
|
7
|
-
|
12
|
+
|
8
13
|
def print_message(gem_name, ruby_version)
|
9
14
|
puts "\n Ruby => #{ruby_version}: I searched the #{gem_name} binary path and I don't find nothing. You have the #{gem_name} installed in this version?"
|
10
15
|
end
|
11
|
-
|
16
|
+
|
12
17
|
def search_binary(binary_name, options)
|
13
|
-
|
18
|
+
rvm_bin_path(options[:environment], binary_name)
|
14
19
|
end
|
15
|
-
|
20
|
+
|
16
21
|
def have_binary?(binary)
|
17
22
|
File.exist?(binary)
|
18
23
|
end
|
19
|
-
|
24
|
+
|
25
|
+
module ClassMethods
|
26
|
+
|
27
|
+
# Set the binary to search in the RVM binary folder
|
28
|
+
#
|
29
|
+
# binary :bundle
|
30
|
+
#
|
31
|
+
def binary(binary_name, options={})
|
32
|
+
method_sufix = options[:name] || binary_name
|
33
|
+
eval <<-EVAL
|
34
|
+
def search_#{method_sufix}(environment)
|
35
|
+
search_binary('#{binary_name}', :environment => environment)
|
36
|
+
end
|
37
|
+
EVAL
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
20
42
|
end
|
21
|
-
end
|
43
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module InfinityTest
|
2
|
+
module Builder
|
3
|
+
|
4
|
+
#
|
5
|
+
def construct_command(options)
|
6
|
+
binary_name, ruby_version, command, file, environment = resolve_options(options)
|
7
|
+
unless have_binary?(binary_name) || options[:skip_binary?]
|
8
|
+
print_message(binary_name, ruby_version)
|
9
|
+
else
|
10
|
+
command = "#{command} #{decide_files(file)}"
|
11
|
+
rvm_ruby_version = "rvm #{ruby_version} ruby"
|
12
|
+
if application.have_gemfile? and not application.skip_bundler?
|
13
|
+
run_with_bundler!(rvm_ruby_version, command, environment)
|
14
|
+
else
|
15
|
+
run_without_bundler!(rvm_ruby_version, command)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
def run_with_bundler!(rvm_ruby_version, command, environment)
|
22
|
+
bundle_binary = search_bundle(environment)
|
23
|
+
unless have_binary?(bundle_binary)
|
24
|
+
print_message('bundle', environment.expanded_name)
|
25
|
+
else
|
26
|
+
%{#{rvm_ruby_version} #{bundle_binary} exec #{command}}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
def run_without_bundler!(rvm_ruby_version, command)
|
32
|
+
%{#{rvm_ruby_version} #{command}}
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# Contruct all the Commands for each ruby instance variable
|
37
|
+
# If don't want to run with many rubies, add the current ruby to the rubies instance
|
38
|
+
# and create the command with current ruby
|
39
|
+
#
|
40
|
+
def construct_commands(file=nil)
|
41
|
+
@rubies << RVM::Environment.current.environment_name if @rubies.empty?
|
42
|
+
construct_rubies_commands(file)
|
43
|
+
end
|
44
|
+
|
45
|
+
def resolve_options(options)
|
46
|
+
ruby_version = options[:for]
|
47
|
+
binary_name = options[:skip_binary?] ? '' : options[:binary]
|
48
|
+
load_path = %{-I"#{options[:load_path]}"} if options[:load_path]
|
49
|
+
environment = options[:environment]
|
50
|
+
file = options[:file]
|
51
|
+
command = [ binary_name, load_path].compact.join(' ')
|
52
|
+
[binary_name, ruby_version, command, file, environment]
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
module InfinityTest
|
2
2
|
class Command
|
3
3
|
attr_accessor :command, :results, :line, :ruby_version
|
4
|
-
|
4
|
+
|
5
5
|
# Create new Command object that receive the ruby_version and the command string
|
6
6
|
#
|
7
7
|
def initialize(options={})
|
8
8
|
@command = options[:command]
|
9
9
|
@ruby_version = options[:ruby_version]
|
10
|
+
@current_ruby_string = RVM::Environment.current_ruby_string
|
10
11
|
@results = []
|
11
12
|
@line = []
|
12
13
|
end
|
@@ -15,19 +16,22 @@ module InfinityTest
|
|
15
16
|
#
|
16
17
|
def run!
|
17
18
|
old_sync = $stdout.sync
|
18
|
-
$stdout.sync = true
|
19
|
+
$stdout.sync = true
|
19
20
|
begin
|
20
21
|
open("| #{@command}", "r") do |file|
|
21
22
|
until file.eof? do
|
22
|
-
test_line = file.getc
|
23
|
-
|
24
|
-
|
23
|
+
test_line = file.getc or break
|
24
|
+
if yarv?
|
25
|
+
print(test_line)
|
26
|
+
else
|
27
|
+
putc(test_line)
|
28
|
+
end
|
25
29
|
@line.push(test_line)
|
26
30
|
push_in_the_results(test_line)
|
27
31
|
end
|
28
32
|
end
|
29
33
|
ensure
|
30
|
-
$stdout.sync = old_sync
|
34
|
+
$stdout.sync = old_sync
|
31
35
|
end
|
32
36
|
@results = @results.join
|
33
37
|
self
|
@@ -38,27 +42,17 @@ module InfinityTest
|
|
38
42
|
# Join otherwise.
|
39
43
|
#
|
40
44
|
def push_in_the_results(test_line)
|
41
|
-
if
|
42
|
-
@results.push(
|
45
|
+
if test_line == ?\n
|
46
|
+
@results.push(yarv? ? @line.join : @line.pack('c*'))
|
43
47
|
@line.clear
|
44
48
|
end
|
45
49
|
end
|
46
|
-
|
47
|
-
# Using
|
48
|
-
#
|
49
|
-
def ree?
|
50
|
-
RVM::Environment.current_ruby_string =~ /ree/
|
51
|
-
end
|
52
|
-
|
53
|
-
# Using mri?
|
50
|
+
|
51
|
+
# Using yarv?
|
54
52
|
#
|
55
|
-
def
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
def end_of_line?(test_line)
|
60
|
-
test_line == ?\n
|
53
|
+
def yarv?
|
54
|
+
@current_ruby_string =~ /ruby-1.9/
|
61
55
|
end
|
62
|
-
|
56
|
+
|
63
57
|
end
|
64
|
-
end
|
58
|
+
end
|
@@ -1,34 +1,35 @@
|
|
1
1
|
module InfinityTest
|
2
2
|
class Configuration
|
3
|
-
|
3
|
+
|
4
4
|
SUPPORTED_FRAMEWORKS = [:growl, :lib_notify] # :snarl, :lib_notify
|
5
|
-
|
6
|
-
attr_accessor :notification_framework,
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
|
6
|
+
attr_accessor :notification_framework,
|
7
|
+
:sucess_image, :failure_image, :pending_image,
|
8
|
+
:rubies, :test_framework, :app_framework,
|
9
|
+
:exceptions_to_ignore, :cucumber,
|
10
|
+
:before_callback, :before_each_ruby_callback, :before_environment_callback,
|
11
|
+
:after_callback, :after_each_ruby_callback,
|
12
|
+
:verbose
|
13
|
+
|
14
14
|
IMAGES_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'images'))
|
15
|
-
|
15
|
+
|
16
16
|
SUCESS = 'sucess'
|
17
17
|
FAILURE = 'failure'
|
18
18
|
PENDING = 'pending'
|
19
|
-
|
19
|
+
|
20
20
|
# Initialize the Configuration object that keeps the images, callbacks, rubies
|
21
21
|
# and the test framework
|
22
|
-
#
|
22
|
+
#
|
23
23
|
def initialize
|
24
24
|
@default_dir_image = File.join(IMAGES_DIR, 'simpson')
|
25
25
|
@test_framework = :test_unit
|
26
|
+
@app_framework = :rubygems
|
26
27
|
@sucess_image = search_image(SUCESS)
|
27
28
|
@failure_image = search_image(FAILURE)
|
28
29
|
@pending_image = search_image(PENDING)
|
29
30
|
@verbose = false
|
30
31
|
end
|
31
|
-
|
32
|
+
|
32
33
|
# Set the notification framework to use with Infinity Test.
|
33
34
|
# The supported Notification Frameworks are:
|
34
35
|
#
|
@@ -44,7 +45,8 @@ module InfinityTest
|
|
44
45
|
# notifications :lib_notify
|
45
46
|
#
|
46
47
|
def notifications(framework, &block)
|
47
|
-
|
48
|
+
message = "Notification :#{framework} don't supported. The Frameworks supported are: #{SUPPORTED_FRAMEWORKS.join(',')}"
|
49
|
+
raise NotificationFrameworkDontSupported, message unless SUPPORTED_FRAMEWORKS.include?(framework)
|
48
50
|
@notification_framework = framework
|
49
51
|
yield self if block_given?
|
50
52
|
self
|
@@ -53,9 +55,9 @@ module InfinityTest
|
|
53
55
|
# Set the Success and Failure image to show in the notification framework
|
54
56
|
#
|
55
57
|
# show_images :failure => 'Users/tomas/images/my_custom_image.png', :sucess => 'custom_image.jpg'
|
56
|
-
#
|
58
|
+
#
|
57
59
|
# Or you cant set modes(directory) for show images (please see the images folder in => http://github.com/tomas-stefano/infinity_test/tree/master/images/ )
|
58
|
-
#
|
60
|
+
#
|
59
61
|
# show_images :mode => :simpson # => This will show images in the folder http://github.com/tomas-stefano/infinity_test/tree/master/images/simpson
|
60
62
|
# show_images :mode => :street_fighter # => This will show images in folder http://github.com/tomas-stefano/infinity_test/tree/master/images/street_fighter
|
61
63
|
# show_images :mode => '~/My/Mode' # => This will show images in the '~/My/Mode' directory
|
@@ -69,7 +71,7 @@ module InfinityTest
|
|
69
71
|
@failure_image = options[:failure] || search_image(FAILURE)
|
70
72
|
@pending_image = options[:pending] || search_image(PENDING)
|
71
73
|
end
|
72
|
-
|
74
|
+
|
73
75
|
# Switch the image directory to show
|
74
76
|
#
|
75
77
|
def switch_mode!(mode)
|
@@ -80,51 +82,78 @@ module InfinityTest
|
|
80
82
|
@default_dir_image = File.expand_path(File.join(mode))
|
81
83
|
end
|
82
84
|
end
|
83
|
-
|
85
|
+
|
84
86
|
# Search the sucess, failure or pending images and return the first in the pattern
|
85
87
|
#
|
86
88
|
def search_image(file)
|
87
89
|
Dir.glob(File.join(@default_dir_image, file) + '*').first
|
88
90
|
end
|
89
|
-
|
91
|
+
|
90
92
|
# The options method to set:
|
91
93
|
#
|
92
|
-
# * test framework
|
94
|
+
# * test framework
|
93
95
|
# * ruby versions
|
94
|
-
#
|
96
|
+
# * verbose mode
|
97
|
+
# * app_framework
|
98
|
+
#
|
95
99
|
# Here is the example of Little Domain Language:
|
96
100
|
#
|
97
101
|
# use :rubies => ['1.9.1', '1.9.2'], :test_framework => :rspec
|
98
102
|
#
|
99
103
|
# use :rubies => [ '1.8.7-p249', '1.9.2@rails3'], :test_framework => :test_unit
|
100
104
|
#
|
105
|
+
# use :test_framework => :rspec, :app_framework => :rails
|
106
|
+
#
|
101
107
|
def use(options={})
|
102
108
|
rubies = options[:rubies]
|
103
109
|
@rubies = (rubies.is_a?(Array) ? rubies.join(',') : rubies) || []
|
104
110
|
@test_framework = options[:test_framework] || @test_framework
|
105
|
-
@
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
+
@app_framework = options[:app_framework] || @app_framework
|
112
|
+
@verbose = options[:verbose] || @verbose
|
113
|
+
@cucumber = options[:cucumber]
|
114
|
+
setting_gemset_for_each_rubies(options[:gemset]) if options[:gemset]
|
115
|
+
end
|
116
|
+
|
117
|
+
# Setting a gemset for each rubies
|
118
|
+
#
|
119
|
+
# setting_gemset_for_each_rubies('infinity_test') # => ['1.8.7@infinity_test', '1.9.2@infinity_test']
|
120
|
+
#
|
121
|
+
def setting_gemset_for_each_rubies(gemset)
|
122
|
+
@rubies = @rubies.split(',').collect { |ruby| ruby << "@#{gemset}" }.join(',')
|
123
|
+
end
|
124
|
+
|
125
|
+
# InfinityTest try to use bundler if Gemfile is present.
|
126
|
+
# This method tell to InfinityTest to not use this convention.
|
127
|
+
#
|
128
|
+
def skip_bundler!
|
129
|
+
@skip_bundler = true
|
111
130
|
end
|
112
|
-
|
131
|
+
|
132
|
+
# Return false if you want the InfinityTest run with bundler
|
133
|
+
#
|
134
|
+
def skip_bundler?
|
135
|
+
@skip_bundler ? true : false
|
136
|
+
end
|
137
|
+
|
138
|
+
def cucumber?
|
139
|
+
@cucumber
|
140
|
+
end
|
141
|
+
|
113
142
|
# Method to use to ignore some dir/files changes
|
114
|
-
#
|
143
|
+
#
|
115
144
|
# Example:
|
116
145
|
#
|
117
146
|
# ignore :exceptions => %w(.svn .hg .git vendor tmp config rerun.txt)
|
118
147
|
#
|
119
|
-
# This is useless right now in the Infinity Test because the library
|
148
|
+
# This is useless right now in the Infinity Test because the library
|
120
149
|
# only monitoring lib and test/spec/feature folder.
|
121
150
|
#
|
122
151
|
def ignore(options={})
|
123
152
|
@exceptions_to_ignore = options[:exceptions] || []
|
124
153
|
end
|
125
|
-
|
154
|
+
|
126
155
|
# Callback method to run anything you want, before the run the test suite command
|
127
|
-
#
|
156
|
+
#
|
128
157
|
# Example:
|
129
158
|
#
|
130
159
|
# before_run do
|
@@ -134,9 +163,9 @@ module InfinityTest
|
|
134
163
|
def before_run(&block)
|
135
164
|
@before_callback = block
|
136
165
|
end
|
137
|
-
|
166
|
+
|
138
167
|
# Callback method to run anything you want, after the run the test suite command
|
139
|
-
#
|
168
|
+
#
|
140
169
|
# Example:
|
141
170
|
#
|
142
171
|
# after_run do
|
@@ -146,7 +175,7 @@ module InfinityTest
|
|
146
175
|
def after_run(&block)
|
147
176
|
@after_callback = block
|
148
177
|
end
|
149
|
-
|
178
|
+
|
150
179
|
# Callback method to handle before or after all run and for each ruby too!
|
151
180
|
#
|
152
181
|
# Example:
|
@@ -167,9 +196,9 @@ module InfinityTest
|
|
167
196
|
#
|
168
197
|
#
|
169
198
|
def before(hook=:all, &block)
|
170
|
-
setting_callback(hook, :all => :@before_callback, :each_ruby => :@before_each_ruby_callback, &block)
|
199
|
+
setting_callback(hook, :all => :@before_callback, :each_ruby => :@before_each_ruby_callback, :env => :@before_environment_callback, &block)
|
171
200
|
end
|
172
|
-
|
201
|
+
|
173
202
|
# Callback method to handle before or after all run and for each ruby too!
|
174
203
|
#
|
175
204
|
# Example:
|
@@ -191,15 +220,39 @@ module InfinityTest
|
|
191
220
|
def after(hook=:all, &block)
|
192
221
|
setting_callback(hook, :all => :@after_callback, :each_ruby => :@after_each_ruby_callback, &block)
|
193
222
|
end
|
194
|
-
|
223
|
+
|
195
224
|
# Clear the terminal (Useful in the before callback)
|
196
225
|
#
|
197
226
|
def clear(option)
|
198
227
|
system('clear') if option == :terminal
|
199
228
|
end
|
200
229
|
|
230
|
+
def replace_patterns(&block)
|
231
|
+
block.call(InfinityTest.application)
|
232
|
+
InfinityTest.application
|
233
|
+
end
|
234
|
+
alias :before_env :replace_patterns
|
235
|
+
|
236
|
+
# Added heuristics to the User application
|
237
|
+
#
|
238
|
+
def heuristics(&block)
|
239
|
+
@heuristics ||= Heuristics.new
|
240
|
+
@heuristics.instance_eval(&block)
|
241
|
+
@heuristics
|
242
|
+
end
|
243
|
+
|
244
|
+
# Set #watch methods (For more information see Watchr gem)
|
245
|
+
#
|
246
|
+
# If don't want the heuristics 'magic'
|
247
|
+
#
|
248
|
+
def watch(pattern, &block)
|
249
|
+
@script ||= InfinityTest.watchr
|
250
|
+
@script.watch(pattern, &block)
|
251
|
+
@script
|
252
|
+
end
|
253
|
+
|
201
254
|
private
|
202
|
-
|
255
|
+
|
203
256
|
def setting_callback(hook, callback, &block)
|
204
257
|
if hook == :all
|
205
258
|
instance_variable_set(callback[:all], block)
|
@@ -207,7 +260,7 @@ module InfinityTest
|
|
207
260
|
instance_variable_set(callback[:each_ruby], block)
|
208
261
|
end
|
209
262
|
end
|
210
|
-
|
263
|
+
|
211
264
|
end
|
212
265
|
end
|
213
266
|
|
@@ -215,7 +268,6 @@ class NotificationFrameworkDontSupported < StandardError
|
|
215
268
|
end
|
216
269
|
|
217
270
|
def infinity_test(&block)
|
218
|
-
|
219
|
-
configuration
|
220
|
-
configuration
|
271
|
+
InfinityTest.configuration.instance_eval(&block)
|
272
|
+
InfinityTest.configuration
|
221
273
|
end
|