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
data/lib/infinity_test/rspec.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
module InfinityTest
|
2
|
-
class Rspec
|
3
|
-
include BinaryPath
|
4
|
-
attr_accessor :rubies, :test_directory_pattern, :message, :test_pattern,
|
5
|
-
:failure, :sucess, :pending
|
6
|
-
|
7
|
-
#
|
8
|
-
# rspec = InfinityTest::Rspec.new(:rubies => '1.9.1,1.9.2')
|
9
|
-
# rspec.rubies # => '1.9.1,1.9.2'
|
10
|
-
#
|
11
|
-
def initialize(options={})
|
12
|
-
@rubies = options[:rubies] || []
|
13
|
-
@test_directory_pattern = "^spec/*/(.*)_spec.rb"
|
14
|
-
@test_pattern = options[:test_pattern] || 'spec/**/*_spec.rb'
|
15
|
-
end
|
16
|
-
|
17
|
-
def construct_commands(file=nil)
|
18
|
-
@rubies << RVM::Environment.current.environment_name if @rubies.empty?
|
19
|
-
construct_rubies_commands(file)
|
20
|
-
end
|
21
|
-
|
22
|
-
def all_files
|
23
|
-
Dir[@test_pattern]
|
24
|
-
end
|
25
|
-
|
26
|
-
def spec_files
|
27
|
-
all_files.collect { |file| file }.join(' ')
|
28
|
-
end
|
29
|
-
|
30
|
-
def construct_rubies_commands(file=nil)
|
31
|
-
results = Hash.new
|
32
|
-
RVM.environments(@rubies) do |environment|
|
33
|
-
ruby_version = environment.environment_name
|
34
|
-
rspec_binary = search_rspec_two(environment)
|
35
|
-
rspec_binary = search_rspec_one(environment) unless File.exist?(rspec_binary)
|
36
|
-
unless have_binary?(rspec_binary)
|
37
|
-
print_message('rspec', ruby_version)
|
38
|
-
else
|
39
|
-
results[ruby_version] = "rvm #{ruby_version} ruby #{rspec_binary} #{decide_files(file)}"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
results
|
43
|
-
end
|
44
|
-
|
45
|
-
# TODO: I'm not satisfied yet
|
46
|
-
#
|
47
|
-
def decide_files(file)
|
48
|
-
return file if file
|
49
|
-
spec_files
|
50
|
-
end
|
51
|
-
|
52
|
-
def search_rspec_two(environment)
|
53
|
-
search_binary('rspec', :environment => environment)
|
54
|
-
end
|
55
|
-
|
56
|
-
def search_rspec_one(environment)
|
57
|
-
search_binary('spec', :environment => environment)
|
58
|
-
end
|
59
|
-
|
60
|
-
def parse_results(results)
|
61
|
-
shell_result = results.split("\n").last
|
62
|
-
if shell_result =~ /example/
|
63
|
-
@example = shell_result[/(\d+) example/, 1].to_i
|
64
|
-
@failure = shell_result[/(\d+) failure/, 1].to_i
|
65
|
-
@pending = shell_result[/(\d+) pending/, 1].to_i
|
66
|
-
@message = "#{@example} examples, #{@failure} failures, #{@pending} pending"
|
67
|
-
else
|
68
|
-
@example, @pending, @failure = 0, 0, 1
|
69
|
-
@message = "An exception occurred"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def sucess?
|
74
|
-
return false if failure? or pending?
|
75
|
-
true
|
76
|
-
end
|
77
|
-
|
78
|
-
def failure?
|
79
|
-
@failure > 0
|
80
|
-
end
|
81
|
-
|
82
|
-
def pending?
|
83
|
-
@pending > 0 and not failure?
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
87
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
module InfinityTest
|
2
|
-
class TestUnit
|
3
|
-
attr_reader :rubies, :message, :test_directory_pattern, :tests,
|
4
|
-
:assertions, :failures, :errors
|
5
|
-
|
6
|
-
def initialize(options={})
|
7
|
-
@rubies = options[:rubies] || []
|
8
|
-
@test_directory_pattern = "^test/*/(.*)_test.rb"
|
9
|
-
@test_pattern = 'test/**/*_test.rb'
|
10
|
-
end
|
11
|
-
|
12
|
-
def construct_commands(file=nil)
|
13
|
-
@rubies << RVM::Environment.current.environment_name if @rubies.empty?
|
14
|
-
construct_rubies_commands(file)
|
15
|
-
end
|
16
|
-
|
17
|
-
def construct_rubies_commands(file=nil)
|
18
|
-
results = Hash.new
|
19
|
-
RVM.environments(@rubies) do |environment|
|
20
|
-
ruby_version = environment.environment_name
|
21
|
-
results[ruby_version] = "rvm #{ruby_version} ruby -I'lib:test' #{decide_files(file)}"
|
22
|
-
end
|
23
|
-
results
|
24
|
-
end
|
25
|
-
|
26
|
-
def decide_files(file)
|
27
|
-
return file if file
|
28
|
-
test_files
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_files
|
32
|
-
collect_test_files.unshift(test_loader).join(' ')
|
33
|
-
end
|
34
|
-
|
35
|
-
def collect_test_files
|
36
|
-
all_files.collect { |file| file }
|
37
|
-
end
|
38
|
-
|
39
|
-
def all_files
|
40
|
-
Dir[@test_pattern]
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_loader
|
44
|
-
$LOAD_PATH.each do |path|
|
45
|
-
file_path = File.join(path, "infinity_test/test_unit_loader.rb")
|
46
|
-
return file_path if File.exist?(file_path)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def parse_results(results)
|
51
|
-
shell_result = results.split("\n")
|
52
|
-
shell_result = shell_result.select { |line| line =~ /(\d+) tests/}.first
|
53
|
-
if shell_result
|
54
|
-
@tests = shell_result[/(\d+) tests/, 1].to_i
|
55
|
-
@assertions = shell_result[/(\d+) assertions/, 1].to_i
|
56
|
-
@failures = shell_result[/(\d+) failures/, 1].to_i
|
57
|
-
@errors = shell_result[/(\d+) errors/, 1].to_i
|
58
|
-
@message = shell_result
|
59
|
-
else
|
60
|
-
@tests, @assertions, @failures, @errors = 0, 0, 1, 1
|
61
|
-
@message = "An exception ocurred"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def failure?
|
66
|
-
@failures > 0 or @errors > 0
|
67
|
-
end
|
68
|
-
|
69
|
-
def pending?
|
70
|
-
false # Don't have pending in Test::Unit right?? #doubt
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
@@ -1,189 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module InfinityTest
|
4
|
-
describe Rspec do
|
5
|
-
before do
|
6
|
-
@current_dir = Dir.pwd
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should be possible to set all rubies" do
|
10
|
-
Rspec.new(:rubies => '1.9.1').rubies.should be == '1.9.1'
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should set the rubies" do
|
14
|
-
Rspec.new(:rubies => 'jruby,ree').rubies.should be == 'jruby,ree'
|
15
|
-
end
|
16
|
-
|
17
|
-
it "rubies should be empty when not have rubies" do
|
18
|
-
Rspec.new.rubies.should be_empty
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have the pattern for spec directory" do
|
22
|
-
Rspec.new.test_directory_pattern.should be == "^spec/*/(.*)_spec.rb"
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should set a default test pattern when have none' do
|
26
|
-
Rspec.new.test_pattern.should == 'spec/**/*_spec.rb'
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should possible to set the test pattern" do
|
30
|
-
Rspec.new(:test_pattern => 'spec/**/spec_*.rb').test_pattern.should == 'spec/**/spec_*.rb'
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#spec_files' do
|
34
|
-
|
35
|
-
let(:rspec) { Rspec.new }
|
36
|
-
|
37
|
-
it "return should include the spec files" do
|
38
|
-
Dir.chdir("#{@current_dir}/spec/factories/buzz") do
|
39
|
-
rspec.spec_files.should be == "spec/buzz_spec.rb"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
it "return should include the spec files to test them" do
|
44
|
-
Dir.chdir("#{@current_dir}/spec/factories/wood") do
|
45
|
-
rspec.spec_files.should be == "spec/wood_spec.rb"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
it "return should include the spec files to test them in two level of the spec folder" do
|
50
|
-
Dir.chdir("#{@current_dir}/spec/factories/slinky") do
|
51
|
-
rspec.spec_files.should be == "spec/slinky/slinky_spec.rb"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
describe '#decide_files' do
|
58
|
-
|
59
|
-
before { @rspec = Rspec.new }
|
60
|
-
|
61
|
-
it "should not call the spec file when match pattern" do
|
62
|
-
@rspec.should_not_receive(:spec_files)
|
63
|
-
@rspec.decide_files('application_spec.rb')
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should call the spec files when pattern is nil" do
|
67
|
-
@rspec.should_receive(:spec_files)
|
68
|
-
@rspec.decide_files(nil)
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
describe '#handle_results' do
|
74
|
-
|
75
|
-
before do
|
76
|
-
@rspec = Rspec.new
|
77
|
-
end
|
78
|
-
|
79
|
-
it "should handle a example that succeed" do
|
80
|
-
results = "........Finished in 0.299817 seconds\n\n105 examples, 0 failures, 0 pending\n"
|
81
|
-
@rspec.parse_results(results)
|
82
|
-
@rspec.message.should == "105 examples, 0 failures, 0 pending"
|
83
|
-
end
|
84
|
-
|
85
|
-
it "should parse without the terminal ansi color" do
|
86
|
-
results = "ork\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # ./spec/infinity_test/configuration_spec.rb:31\e[0m\n\nFinished in 0.10487 seconds\n\e[33m406 examples, 5 failures, 2 pending\e[0m\n"
|
87
|
-
@rspec.parse_results(results)
|
88
|
-
@rspec.message.should == "406 examples, 5 failures, 2 pending"
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should handle a example that succeed and return false for failure?" do
|
92
|
-
results = "........Finished in 0.299817 seconds\n\n105 examples, 0 failures, 0 pending\n"
|
93
|
-
@rspec.parse_results(results)
|
94
|
-
@rspec.failure?.should equal false
|
95
|
-
end
|
96
|
-
|
97
|
-
it "should parse without the terminal ansi color and grep the failure" do
|
98
|
-
results = "ork\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # ./spec/infinity_test/configuration_spec.rb:31\e[0m\n\nFinished in 0.10487 seconds\n\e[33m406 examples, 5 failures, 2 pending\e[0m\n"
|
99
|
-
@rspec.parse_results(results)
|
100
|
-
@rspec.failure?.should be_true
|
101
|
-
end
|
102
|
-
|
103
|
-
it "should parse without the terminal ansi color and grep the pending" do
|
104
|
-
results = "ork\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # ./spec/infinity_test/configuration_spec.rb:31\e[0m\n\nFinished in 0.10487 seconds\n\e[33m406 examples, 0 failures, 2 pending\e[0m\n"
|
105
|
-
@rspec.parse_results(results)
|
106
|
-
@rspec.pending?.should be_true
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should parse rspec tests errors" do
|
110
|
-
results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
|
111
|
-
@rspec.parse_results(results)
|
112
|
-
@rspec.message.should == "An exception occurred"
|
113
|
-
end
|
114
|
-
|
115
|
-
it "should parse rspec tests errors" do
|
116
|
-
results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
|
117
|
-
@rspec.parse_results(results)
|
118
|
-
@rspec.failure?.should be_true
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should parse rspec tests errors" do
|
122
|
-
results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
|
123
|
-
@rspec.parse_results(results)
|
124
|
-
@rspec.sucess?.should equal false
|
125
|
-
end
|
126
|
-
|
127
|
-
it "should parse rspec tests errors" do
|
128
|
-
results = "/Users/tomas/.rvm/gems/ruby-1.9.2@infinity_test/gems/my_class/bin/klass:2:in `require': no such file to load -- MyClass (LoadError)"
|
129
|
-
@rspec.parse_results(results)
|
130
|
-
@rspec.pending?.should equal false
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe '#sucess?' do
|
135
|
-
before { @rspec = Rspec.new }
|
136
|
-
|
137
|
-
it "should return false when have failures" do
|
138
|
-
results = "ork\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # ./spec/infinity_test/configuration_spec.rb:31\e[0m\n\nFinished in 0.10487 seconds\n\e[33m406 examples, 5 failures, 2 pending\e[0m\n"
|
139
|
-
@rspec.parse_results(results)
|
140
|
-
@rspec.sucess?.should equal false
|
141
|
-
end
|
142
|
-
|
143
|
-
it "should return false when have pending" do
|
144
|
-
results = "ork\e[0m\n\e[90m # No reason given\e[0m\n\e[90m # ./spec/infinity_test/configuration_spec.rb:31\e[0m\n\nFinished in 0.10487 seconds\n\e[33m806 examples, 0 failures, 2 pending\e[0m\n"
|
145
|
-
@rspec.parse_results(results)
|
146
|
-
@rspec.sucess?.should be_false
|
147
|
-
end
|
148
|
-
|
149
|
-
it "should return true when have zero failures and zero pending" do
|
150
|
-
results = "........Finished in 0.299817 seconds\n\n105 examples, 0 failures, 0 pending\n"
|
151
|
-
@rspec.parse_results(results)
|
152
|
-
@rspec.sucess?.should be_true
|
153
|
-
end
|
154
|
-
|
155
|
-
end
|
156
|
-
|
157
|
-
describe '#pending?' do
|
158
|
-
let(:rspec) { Rspec.new }
|
159
|
-
|
160
|
-
it "should return true when have pending" do
|
161
|
-
rspec.pending = 1
|
162
|
-
rspec.failure = 0
|
163
|
-
rspec.pending?.should be_true
|
164
|
-
end
|
165
|
-
|
166
|
-
it "should return false when have pending bu thave failures" do
|
167
|
-
rspec.pending = 1
|
168
|
-
rspec.failure = 1
|
169
|
-
rspec.pending?.should equal false
|
170
|
-
end
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
def redefine_const(name,value)
|
175
|
-
if Object.const_defined?(name)
|
176
|
-
old_value = Object.const_get(name)
|
177
|
-
Object.send(:remove_const, name)
|
178
|
-
else
|
179
|
-
old_value = value
|
180
|
-
end
|
181
|
-
Object.const_set(name,value)
|
182
|
-
yield
|
183
|
-
ensure
|
184
|
-
Object.send(:remove_const, name)
|
185
|
-
Object.const_set(name, old_value)
|
186
|
-
end
|
187
|
-
|
188
|
-
end
|
189
|
-
end
|
@@ -1,182 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module InfinityTest
|
4
|
-
describe TestUnit do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@current_dir = Dir.pwd
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should be possible to set all rubies" do
|
11
|
-
TestUnit.new(:rubies => 'jruby').rubies.should be == 'jruby'
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should be possible to set any rubies that I want" do
|
15
|
-
TestUnit.new(:rubies => 'ree,1.9.1,1.9.2').rubies.should be == 'ree,1.9.1,1.9.2'
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should have the test directory pattern" do
|
19
|
-
TestUnit.new(:rubies => 'ree,1.9.1').test_directory_pattern.should be == "^test/*/(.*)_test.rb"
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should be empty when not have rubies" do
|
23
|
-
TestUnit.new.rubies.should be == []
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#test_loader" do
|
27
|
-
let(:test_unit) { TestUnit.new }
|
28
|
-
it "should call files to test with test_loader" do
|
29
|
-
Dir.chdir("#{@current_dir}/spec/factories/travel") do
|
30
|
-
test_unit.test_loader.should eql "#{@current_dir}/lib/infinity_test/test_unit_loader.rb"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context "should call more than one file to test with test_loader" do
|
35
|
-
|
36
|
-
it "return should include test/company_test.rb" do
|
37
|
-
Dir.chdir("#{@current_dir}/spec/factories/company") do
|
38
|
-
test_unit.collect_test_files.should eql ["test/company_test.rb"]
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
it "return should include more than one file to test" do
|
43
|
-
Dir.chdir("#{@current_dir}/spec/factories/travel") do
|
44
|
-
test_unit.collect_test_files.should eql ["test/partner_test.rb","test/travel_test.rb"]
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe '#construct_commands' do
|
52
|
-
|
53
|
-
it "should return a Hash when not have rubies" do
|
54
|
-
TestUnit.new.construct_commands.should be_instance_of(Hash)
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '#parse_results' do
|
60
|
-
|
61
|
-
before do
|
62
|
-
@test_unit = TestUnit.new
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should parse when have all passed" do
|
66
|
-
results = ".....\n3 tests, 3 assertions, 0 failures, 0 errors, 0 skips"
|
67
|
-
@test_unit.parse_results(results)
|
68
|
-
@test_unit.message.should == "3 tests, 3 assertions, 0 failures, 0 errors, 0 skips"
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should parse when have extra message (in Ruby 1.9.*)" do
|
72
|
-
results = "\nFinished in 0.001742 seconds.\n\n3 tests, 3 assertions, 1 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
73
|
-
@test_unit.parse_results(results)
|
74
|
-
@test_unit.message.should == "3 tests, 3 assertions, 1 failures, 1 errors, 1 skips"
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should parse when have a exception" do
|
78
|
-
@test_unit.parse_results("")
|
79
|
-
@test_unit.message.should == "An exception ocurred"
|
80
|
-
end
|
81
|
-
|
82
|
-
it "should parse and set correctly the tests" do
|
83
|
-
results = "\nFinished in 0.8981 seconds.\n\n3 tests, 3 assertions, 1 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
84
|
-
@test_unit.parse_results(results)
|
85
|
-
@test_unit.tests.should == 3
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should parse and set correctly the tests" do
|
89
|
-
results = "\nFinished in 0.5678 seconds.\n\n6 tests, 3 assertions, 1 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
90
|
-
@test_unit.parse_results(results)
|
91
|
-
@test_unit.tests.should == 6
|
92
|
-
end
|
93
|
-
|
94
|
-
it "should parse and set correctly the tests" do
|
95
|
-
results = "\nFinished in 0.34678 seconds.\n\n6 tests, 7 assertions, 1 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
96
|
-
@test_unit.parse_results(results)
|
97
|
-
@test_unit.assertions.should == 7
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should parse and set correctly the tests" do
|
101
|
-
results = "\nFinished in 0.8561 seconds.\n\n3 tests, 4 assertions, 1 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
102
|
-
@test_unit.parse_results(results)
|
103
|
-
@test_unit.assertions.should == 4
|
104
|
-
end
|
105
|
-
|
106
|
-
it "should parse and set correctly the tests" do
|
107
|
-
results = "\nFinished in 0.7654 seconds.\n\n6 tests, 3 assertions, 4 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
108
|
-
@test_unit.parse_results(results)
|
109
|
-
@test_unit.failures.should == 4
|
110
|
-
end
|
111
|
-
|
112
|
-
it "should parse and set correctly the tests" do
|
113
|
-
results = "\nFinished in 0.789065 seconds.\n\n6 tests, 3 assertions, 5 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
114
|
-
@test_unit.parse_results(results)
|
115
|
-
@test_unit.failures.should == 5
|
116
|
-
end
|
117
|
-
|
118
|
-
it "should parse and set correctly the tests" do
|
119
|
-
results = "\nFinished in 0.7654 seconds.\n\n6 tests, 3 assertions, 4 failures, 2 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
120
|
-
@test_unit.parse_results(results)
|
121
|
-
@test_unit.errors.should == 2
|
122
|
-
end
|
123
|
-
|
124
|
-
it "should parse and set correctly the tests" do
|
125
|
-
results = "\nFinished in 0.7654 seconds.\n\n36 tests, 37 assertions, 4 failures, 20 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
126
|
-
@test_unit.parse_results(results)
|
127
|
-
@test_unit.errors.should == 20
|
128
|
-
end
|
129
|
-
|
130
|
-
it "should parse when have a exception and set failure to 1" do
|
131
|
-
@test_unit.parse_results("")
|
132
|
-
@test_unit.failures.should == 1
|
133
|
-
@test_unit.tests.should == 0
|
134
|
-
@test_unit.assertions.should == 0
|
135
|
-
@test_unit.errors.should == 1
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
|
140
|
-
describe '#failure?' do
|
141
|
-
|
142
|
-
before do
|
143
|
-
@test_unit = TestUnit.new
|
144
|
-
end
|
145
|
-
|
146
|
-
it "should return true when have failures" do
|
147
|
-
@test_unit.parse_results(".....\n3 tests, 3 assertions, 1 failures, 0 errors, 0 skips")
|
148
|
-
@test_unit.failure?.should be_true
|
149
|
-
end
|
150
|
-
|
151
|
-
it "should return true when have errors" do
|
152
|
-
@test_unit.parse_results(".....\n3 tests, 3 assertions, 0 failures, 4 errors, 0 skips")
|
153
|
-
@test_unit.failure?.should be_true
|
154
|
-
end
|
155
|
-
|
156
|
-
it "should return true when have nothing" do
|
157
|
-
@test_unit.parse_results("")
|
158
|
-
@test_unit.failure?.should be_true
|
159
|
-
end
|
160
|
-
|
161
|
-
it "should return false when have all suceed :) " do
|
162
|
-
@test_unit.parse_results(".....\n3 tests, 3 assertions, 0 failures, 0 errors, 0 skips")
|
163
|
-
@test_unit.failure?.should be_false
|
164
|
-
end
|
165
|
-
|
166
|
-
it 'should return false when have all assertions and tests suceed \o/ ' do
|
167
|
-
@test_unit.parse_results(".....\n4 tests, 7 assertions, 0 failures, 0 errors, 0 skips")
|
168
|
-
@test_unit.failure?.should be_false
|
169
|
-
end
|
170
|
-
|
171
|
-
end
|
172
|
-
|
173
|
-
describe '#pending?' do
|
174
|
-
|
175
|
-
it "should be false" do
|
176
|
-
TestUnit.new.pending?.should equal false
|
177
|
-
end
|
178
|
-
|
179
|
-
end
|
180
|
-
|
181
|
-
end
|
182
|
-
end
|