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,96 +0,0 @@
|
|
|
1
|
-
require 'optparse'
|
|
2
|
-
|
|
3
|
-
module InfinityTest
|
|
4
|
-
class Options < Hash
|
|
5
|
-
|
|
6
|
-
def initialize(arguments)
|
|
7
|
-
super()
|
|
8
|
-
@options = OptionParser.new do |options|
|
|
9
|
-
[:test_unit, :rspec, :bacon, :rubygems, :rails, :rubies, :verbose, :patterns, :bundler, :version].each do |name|
|
|
10
|
-
send("parse_#{name}", options)
|
|
11
|
-
end
|
|
12
|
-
options.banner = [ "Usage: infinity_test [options]", "Starts a continuous test server."].join("\n")
|
|
13
|
-
options.on_tail("--help", "You're looking at it.") do
|
|
14
|
-
print options.help
|
|
15
|
-
exit
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
@options.parse!(arguments.clone)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def parse_rspec(options)
|
|
22
|
-
options.on('--rspec', 'Test Framework: RSpec') do
|
|
23
|
-
self[:test_framework] = :rspec
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def parse_test_unit(options)
|
|
28
|
-
options.on('--test-unit', 'Test Framework: Test Unit (Default)') do
|
|
29
|
-
self[:test_framework] = :test_unit
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def parse_bacon(options)
|
|
34
|
-
options.on('--bacon', 'Test Framework: Bacon') do
|
|
35
|
-
self[:test_framework] = :bacon
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def parse_rubies(options)
|
|
40
|
-
options.on('--rubies=rubies', 'Specify Ruby version(s) to test against') do |versions|
|
|
41
|
-
rubies = []
|
|
42
|
-
self[:specific_options] = {}
|
|
43
|
-
versions.split(",").each do |r|
|
|
44
|
-
rubie = r.split('+')[0]
|
|
45
|
-
params = r.split('+')[1]
|
|
46
|
-
self[:specific_options][rubie] = params
|
|
47
|
-
rubies << rubie
|
|
48
|
-
end
|
|
49
|
-
self[:rubies] = rubies.join(',')
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def parse_verbose(options)
|
|
54
|
-
options.on('--verbose', 'Print commands before executing them') do
|
|
55
|
-
self[:verbose] = true
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def parse_rails(options)
|
|
60
|
-
options.on('--rails', 'Application Framework: Rails') do
|
|
61
|
-
self[:app_framework] = :rails
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def parse_rubygems(options)
|
|
66
|
-
options.on('--rubygems', 'Application Framework: Rubygems (Default)') do
|
|
67
|
-
self[:app_framework] = :rubygems
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# def parse_cucumber(options)
|
|
72
|
-
# options.on('--cucumber', 'Run with the Cucumber too') do
|
|
73
|
-
# self[:cucumber] = true
|
|
74
|
-
# end
|
|
75
|
-
# end
|
|
76
|
-
|
|
77
|
-
def parse_patterns(options)
|
|
78
|
-
options.on('--heuristics', 'Show all defined heuristics and exit') do
|
|
79
|
-
self[:show_heuristics?] = true
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def parse_bundler(options)
|
|
84
|
-
options.on('--skip-bundler', "Bypass Infinity Test's Bundler support, even if a Gemfile is present") do
|
|
85
|
-
self[:skip_bundler?] = true
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
def parse_version(options)
|
|
90
|
-
options.on("--version", "Show version and exit") do
|
|
91
|
-
puts InfinityTest.version
|
|
92
|
-
exit
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
data/lib/infinity_test/runner.rb
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
class Runner
|
|
3
|
-
attr_reader :options, :application
|
|
4
|
-
|
|
5
|
-
def initialize(argv)
|
|
6
|
-
@options = Options.new(argv)
|
|
7
|
-
@application = InfinityTest.application
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def run!
|
|
11
|
-
load_configuration_file_or_read_the_options!
|
|
12
|
-
if @options[:show_heuristics?]
|
|
13
|
-
list_heuristics!
|
|
14
|
-
else
|
|
15
|
-
@application.run_global_commands!
|
|
16
|
-
start_continuous_testing!
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def list_heuristics!
|
|
21
|
-
@application.heuristics.patterns.keys.each do |pattern|
|
|
22
|
-
puts %{- "#{pattern}"}
|
|
23
|
-
end
|
|
24
|
-
exit
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def load_configuration_file_or_read_the_options!
|
|
28
|
-
@application.load_configuration_file_or_read_the_options!(@options)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Start Continuous Server using Watchr
|
|
32
|
-
#
|
|
33
|
-
def start_continuous_testing!
|
|
34
|
-
InfinityTest::ContinuousTesting.new.start!
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
class TestFramework
|
|
3
|
-
include InfinityTest::BinaryPath
|
|
4
|
-
include InfinityTest::Environment
|
|
5
|
-
include InfinityTest::Builder
|
|
6
|
-
|
|
7
|
-
binary :bundle
|
|
8
|
-
|
|
9
|
-
attr_accessor :application, :message, :rubies, :test_pattern, :specific_options
|
|
10
|
-
|
|
11
|
-
def initialize(options={})
|
|
12
|
-
@application = InfinityTest.application
|
|
13
|
-
@rubies = options[:rubies] || []
|
|
14
|
-
@specific_options = options[:specific_options] || {}
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# Return all the files match by test_pattern
|
|
18
|
-
#
|
|
19
|
-
def all_files
|
|
20
|
-
Dir[@test_pattern].sort
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def test_files
|
|
24
|
-
all_files.collect { |file| file }.join(' ')
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def decide_files(file)
|
|
28
|
-
return file if file
|
|
29
|
-
test_files
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# Method used in the subclasses of TestFramework
|
|
33
|
-
#
|
|
34
|
-
# Example:
|
|
35
|
-
#
|
|
36
|
-
# class Rspec < TestFramework
|
|
37
|
-
# parse_results :example => /(\d+) example/, :failure => /(\d+) failure/, :pending => /(\d+) pending/
|
|
38
|
-
# end
|
|
39
|
-
#
|
|
40
|
-
# Then will create @examples, @failure and @pending instance variables with the values in the test result
|
|
41
|
-
#
|
|
42
|
-
# Or with Test::Unit:
|
|
43
|
-
#
|
|
44
|
-
# class TestUnit < TestFramework
|
|
45
|
-
# parse_results :tests => /(\d+) tests/, :assertions => /(\d+) assertions/, :failures => /(\d+) failures/, :errors => /(\d+) errors/
|
|
46
|
-
# end
|
|
47
|
-
#
|
|
48
|
-
# Then will create @tests, @assertions, @failures and @errors instance variables with the values in the test result
|
|
49
|
-
#
|
|
50
|
-
def self.parse_results(patterns)
|
|
51
|
-
raise(ArgumentError, 'patterns should not be empty') if patterns.empty?
|
|
52
|
-
create_accessors(patterns)
|
|
53
|
-
define_method(:parse_results) do |results|
|
|
54
|
-
set_instances(:shell_result => test_message(results, patterns), :patterns => patterns)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# Create accessors for keys of the Hash passed in argument
|
|
59
|
-
#
|
|
60
|
-
# create_accessors({ :example => '...', :failure => '...'}) # => attr_accessor :example, :failure
|
|
61
|
-
#
|
|
62
|
-
def self.create_accessors(hash)
|
|
63
|
-
hash.keys.each do |attribute|
|
|
64
|
-
attr_accessor attribute
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# Create the instance pass in the patterns options
|
|
69
|
-
#
|
|
70
|
-
# Useful for the parse results:
|
|
71
|
-
# parse_results :tests => /.../, :assertions => /.../
|
|
72
|
-
#
|
|
73
|
-
# Then will create @tests ans @assertions (the keys of the Hash)
|
|
74
|
-
#
|
|
75
|
-
def create_pattern_instance_variables(patterns, shell_result)
|
|
76
|
-
patterns.each do |key, pattern|
|
|
77
|
-
number = shell_result[pattern, 1].to_i
|
|
78
|
-
instance_variable_set("@#{key}", number)
|
|
79
|
-
end
|
|
80
|
-
@message = shell_result.gsub(/\e\[\d+?m/, '') # Clean ANSIColor strings
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# Return the message of the tests
|
|
84
|
-
#
|
|
85
|
-
# test_message('0 examples, 0 failures', { :example => /(\d) example/}) # => '0 examples, 0 failures'
|
|
86
|
-
# test_message('....\n4 examples, 0 failures', { :examples => /(\d) examples/}) # => '4 examples, 0 failures'
|
|
87
|
-
#
|
|
88
|
-
def test_message(output, patterns)
|
|
89
|
-
lines = output.split("\n")
|
|
90
|
-
final_result = []
|
|
91
|
-
patterns.each do |key, pattern|
|
|
92
|
-
final_result << lines.select { |line| line =~ pattern }
|
|
93
|
-
end
|
|
94
|
-
final_result.flatten.last
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
private
|
|
98
|
-
|
|
99
|
-
def set_instances(options)
|
|
100
|
-
shell_result, patterns = options[:shell_result], options[:patterns]
|
|
101
|
-
if shell_result
|
|
102
|
-
create_pattern_instance_variables(patterns, shell_result)
|
|
103
|
-
else
|
|
104
|
-
patterns.each { |instance, pattern| instance_variable_set("@#{instance}", 1) } # set all to 1 to show that an error occurred
|
|
105
|
-
@message = "An exception occurred"
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
end
|
|
110
|
-
end
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
module TestLibrary
|
|
3
|
-
class Bacon < TestFramework
|
|
4
|
-
binary :bacon
|
|
5
|
-
parse_results :specifications => /(\d+) specifications/, :requirements => /(\d+) requirements/, :failures => /(\d+) failure/, :errors => /(\d+) errors/
|
|
6
|
-
|
|
7
|
-
# Bacon Framework
|
|
8
|
-
#
|
|
9
|
-
# For more information about the Bacon see: http://github.com/chneukirchen/bacon
|
|
10
|
-
#
|
|
11
|
-
# bacon = InfinityTest::Bacon.new(:rubies => '1.9.1,1.9.2')
|
|
12
|
-
# bacon.rubies # => '1.9.1,1.9.2'
|
|
13
|
-
# bacon.test_directory_pattern # => "^spec/*/(.*)_spec.rb"
|
|
14
|
-
# bacon.test_pattern # => 'spec/**/*_spec.rb'
|
|
15
|
-
#
|
|
16
|
-
def initialize(options={})
|
|
17
|
-
super(options)
|
|
18
|
-
@test_pattern = 'spec/**/*_spec.rb'
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# Construct all the commands for each ruby
|
|
22
|
-
# First, try to find the bacon binary, and raise/puts an Error if don't find it.
|
|
23
|
-
# After that, verifying if the user have a Gemfile, and if has, run with "bundle exec" command, else will run normally
|
|
24
|
-
#
|
|
25
|
-
def construct_rubies_commands(file=nil)
|
|
26
|
-
commands = {}
|
|
27
|
-
environments do |environment, ruby_version|
|
|
28
|
-
bacon_binary = search_bacon(environment)
|
|
29
|
-
command = construct_command(
|
|
30
|
-
:for => ruby_version,
|
|
31
|
-
:binary => bacon_binary,
|
|
32
|
-
:load_path => 'lib:spec',
|
|
33
|
-
:file => file,
|
|
34
|
-
:environment => environment) || next
|
|
35
|
-
commands[ruby_version] = command
|
|
36
|
-
end
|
|
37
|
-
commands
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def sucess?
|
|
41
|
-
return false if failure?
|
|
42
|
-
true
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def failure?
|
|
46
|
-
@failures > 0
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def pending?
|
|
50
|
-
false # Don't have pending in Bacon
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
module TestLibrary
|
|
3
|
-
class Cucumber < TestFramework
|
|
4
|
-
include HeuristicsHelper
|
|
5
|
-
binary :cucumber
|
|
6
|
-
parse_results :passed => /(\d+) passed/, :failed => /(\d+) failed/
|
|
7
|
-
|
|
8
|
-
def initialize
|
|
9
|
-
add_heuristics!
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def add_heuristics!
|
|
13
|
-
heuristics do
|
|
14
|
-
add("^features/*/*feature") do
|
|
15
|
-
run :all => :tests, :in_dir => :steps_definitions
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
module TestLibrary
|
|
3
|
-
class Rspec < TestFramework
|
|
4
|
-
binary :rspec, :name => :rspec_two
|
|
5
|
-
binary :spec, :name => :rspec_one
|
|
6
|
-
|
|
7
|
-
parse_results :examples => /(\d+) example/, :failures => /(\d+) failure/, :pending => /(\d+) pending/
|
|
8
|
-
|
|
9
|
-
#
|
|
10
|
-
# rspec = InfinityTest::Rspec.new(:rubies => '1.9.1,1.9.2')
|
|
11
|
-
# rspec.rubies # => '1.9.1,1.9.2'
|
|
12
|
-
# rspec.test_pattern # => 'spec/**/*_spec.rb'
|
|
13
|
-
#
|
|
14
|
-
def initialize(options={})
|
|
15
|
-
super(options)
|
|
16
|
-
@test_pattern = 'spec/**/*_spec.rb'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Construct all the commands for each ruby
|
|
20
|
-
# First, try to find the rspec one binary, and if don't have installed
|
|
21
|
-
# try to find rspec two, and raise/puts an Error if don't find it.
|
|
22
|
-
# After that, verifying if the user have a Gemfile, and if has,
|
|
23
|
-
# run with "bundle exec" command, else will run normally
|
|
24
|
-
#
|
|
25
|
-
def construct_rubies_commands(file=nil)
|
|
26
|
-
commands = {}
|
|
27
|
-
environments do |environment, ruby_version|
|
|
28
|
-
rspec_binary = search_rspec_two(environment)
|
|
29
|
-
rspec_binary = search_rspec_one(environment) unless have_binary?(rspec_binary)
|
|
30
|
-
specific_options = @specific_options[ruby_version]
|
|
31
|
-
commands[ruby_version] = construct_command(
|
|
32
|
-
:for => ruby_version,
|
|
33
|
-
:binary => rspec_binary,
|
|
34
|
-
:file => file,
|
|
35
|
-
:environment => environment,
|
|
36
|
-
:specific_options => specific_options)
|
|
37
|
-
end
|
|
38
|
-
commands
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def search_files(file_pattern)
|
|
42
|
-
all_files.grep(/#{file_pattern}/i).join(' ')
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def sucess?
|
|
46
|
-
return false if failure? or pending?
|
|
47
|
-
true
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def failure?
|
|
51
|
-
@failures > 0
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def pending?
|
|
55
|
-
@pending > 0 and not failure?
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
module InfinityTest
|
|
2
|
-
module TestLibrary
|
|
3
|
-
class TestUnit < TestFramework
|
|
4
|
-
parse_results :tests => /(\d+) tests/, :assertions => /(\d+) assertions/,
|
|
5
|
-
:failures => /(\d+) failures/, :errors => /(\d+) errors/
|
|
6
|
-
|
|
7
|
-
def initialize(options={})
|
|
8
|
-
super(options)
|
|
9
|
-
@test_pattern = 'test/**/*_test.rb'
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def construct_rubies_commands(file=nil)
|
|
13
|
-
command = {}
|
|
14
|
-
environments do |environment, ruby_version|
|
|
15
|
-
command[ruby_version] = construct_command(
|
|
16
|
-
:for => ruby_version,
|
|
17
|
-
:load_path => 'lib:test',
|
|
18
|
-
:file => file,
|
|
19
|
-
:environment => environment,
|
|
20
|
-
:skip_binary? => true)
|
|
21
|
-
end
|
|
22
|
-
command
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def test_files
|
|
26
|
-
super.split.unshift(test_loader).sort.join(' ')
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def decide_files(file)
|
|
30
|
-
return file if file
|
|
31
|
-
test_files
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def test_loader
|
|
36
|
-
$LOAD_PATH.each do |path|
|
|
37
|
-
file_path = File.join(path, "infinity_test/test_unit_loader.rb")
|
|
38
|
-
return file_path if File.exist?(file_path)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def failure?
|
|
43
|
-
@failures > 0 or @errors > 0
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def pending?
|
|
47
|
-
false # Don't have pending in Test::Unit right?? #doubt
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module InfinityTest
|
|
4
|
-
module ApplicationLibrary
|
|
5
|
-
describe Rails do
|
|
6
|
-
let(:rails) { Rails.new }
|
|
7
|
-
|
|
8
|
-
describe '#lib_pattern' do
|
|
9
|
-
|
|
10
|
-
it { rails.lib_pattern.should == "^lib/*/(.*)\.rb" }
|
|
11
|
-
|
|
12
|
-
it "should be possible to change the library pattern" do
|
|
13
|
-
rails.lib_pattern = "^another_lib/*/(.*)\.rb"
|
|
14
|
-
rails.lib_pattern.should == "^another_lib/*/(.*)\.rb"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe '#test_pattern' do
|
|
20
|
-
|
|
21
|
-
it "should return the pattern for Test::Unit" do
|
|
22
|
-
stub_application_with_test_unit
|
|
23
|
-
rails.test_pattern.should == "^test/*/(.*)_test.rb"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "should return the pattern for Rspec " do
|
|
27
|
-
stub_application_with_rspec
|
|
28
|
-
rails.test_pattern.should == "^spec/*/(.*)_spec.rb"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe '#configuration_pattern' do
|
|
34
|
-
|
|
35
|
-
it "should set to config/application.rb" do
|
|
36
|
-
rails.configuration_pattern.should == "^config/application.rb"
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it "should possible to change the configuration_pattern" do
|
|
40
|
-
rails.configuration_pattern = "^config/environment.rb"
|
|
41
|
-
rails.configuration_pattern.should == "^config/environment.rb"
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
describe '#routes_pattern' do
|
|
47
|
-
|
|
48
|
-
it "should return the routes_pattern" do
|
|
49
|
-
rails.routes_pattern.should == "^config/routes\.rb"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it "should be possible to set the routes pattern" do
|
|
53
|
-
rails.routes_pattern = "^config/routes_s\.rb"
|
|
54
|
-
rails.routes_pattern.should == "^config/routes_s\.rb"
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
describe '#fixtures_pattern' do
|
|
60
|
-
|
|
61
|
-
it "should set the fixtures pattern" do
|
|
62
|
-
stub_application_with_test_unit
|
|
63
|
-
rails.fixtures_pattern.should == "^test/fixtures/(.*).yml"
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it "should set a diferent fixtures pattern" do
|
|
67
|
-
stub_application_with_rspec
|
|
68
|
-
rails.fixtures_pattern.should == "^spec/fixtures/(.*).yml"
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
describe '#controllers_pattern' do
|
|
74
|
-
|
|
75
|
-
it "should set the controllers pattern" do
|
|
76
|
-
rails.controllers_pattern.should == "^app/controllers/(.*)\.rb"
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
it "should be possible to set the controllers pattern" do
|
|
80
|
-
rails.controllers_pattern = "^app/super_controllers/(.*)\.rb"
|
|
81
|
-
rails.controllers_pattern.should == "^app/super_controllers/(.*)\.rb"
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
describe '#helpers_pattern' do
|
|
87
|
-
it "should return the controllers pattern" do
|
|
88
|
-
rails.helpers_pattern.should == "^app/helpers/(.*)\.rb"
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
it "should be possible to set the controllers pattern" do
|
|
92
|
-
rails.helpers_pattern = "^app/super_helpers/(.*)\.rb"
|
|
93
|
-
rails.helpers_pattern.should == "^app/super_helpers/(.*)\.rb"
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
describe '#mailers_pattern' do
|
|
98
|
-
|
|
99
|
-
it "should return the controllers pattern" do
|
|
100
|
-
rails.mailers_pattern.should == "^app/mailers/(.*)\.rb"
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
it "should be possible to set the controllers pattern" do
|
|
104
|
-
rails.mailers_pattern = "^app/super_mailers/(.*)\.rb"
|
|
105
|
-
rails.mailers_pattern.should == "^app/super_mailers/(.*)\.rb"
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
describe '#application_controller_pattern' do
|
|
111
|
-
it "should return the application controller" do
|
|
112
|
-
rails.application_controller_pattern.should == "^app/controllers/application_controller.rb"
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
describe '#application_helper_pattern' do
|
|
117
|
-
it "should return the application_helper_pattern" do
|
|
118
|
-
rails.application_helper_pattern.should == "^app/helpers/application_helper.rb"
|
|
119
|
-
end
|
|
120
|
-
it "should be possible to set the application helper pattern" do
|
|
121
|
-
rails.application_helper_pattern = "my_pattern"
|
|
122
|
-
rails.application_helper_pattern.should == "my_pattern"
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
describe '#models_pattern' do
|
|
127
|
-
it "should set the controllers pattern" do
|
|
128
|
-
rails.models_pattern.should == "^app/models/(.*)\.rb"
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
it "should be possible to set the controllers pattern" do
|
|
132
|
-
rails.models_pattern = "^app/super_models/(.*)\.rb"
|
|
133
|
-
rails.models_pattern.should == "^app/super_models/(.*)\.rb"
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
|
|
3
|
-
module InfinityTest
|
|
4
|
-
module ApplicationLibrary
|
|
5
|
-
describe RubyGems do
|
|
6
|
-
let(:rubygems) { RubyGems.new }
|
|
7
|
-
|
|
8
|
-
describe '#application' do
|
|
9
|
-
it { rubygems.application.should equal InfinityTest.application }
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe '#lib_pattern' do
|
|
13
|
-
|
|
14
|
-
it { rubygems.lib_pattern.should == "^lib/*/(.*)\.rb" }
|
|
15
|
-
|
|
16
|
-
it "should be possible to change the library pattern" do
|
|
17
|
-
rubygems.lib_pattern = "^another_lib/*/(.*)\.rb"
|
|
18
|
-
rubygems.lib_pattern.should == "^another_lib/*/(.*)\.rb"
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
describe '#test_pattern' do
|
|
24
|
-
|
|
25
|
-
it "should return the pattern for Test::Unit" do
|
|
26
|
-
stub_application_with_test_unit
|
|
27
|
-
rubygems.test_pattern.should == "^test/*/(.*)_test.rb"
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "should return the pattern for Rspec" do
|
|
31
|
-
stub_application_with_rspec
|
|
32
|
-
rubygems.test_pattern.should == "^spec/*/(.*)_spec.rb"
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe '#test_helper_pattern' do
|
|
38
|
-
it "should return the pattern for Test::Unit" do
|
|
39
|
-
stub_application_with_test_unit
|
|
40
|
-
rubygems.test_helper_pattern.should == "^test/*/test_helper.rb"
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it "should return the pattern for Rspec" do
|
|
44
|
-
stub_application_with_rspec
|
|
45
|
-
rubygems.test_helper_pattern.should == "^spec/*/spec_helper.rb"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|