infinity_test 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,150 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module InfinityTest
|
4
|
+
module TestLibrary
|
5
|
+
describe Bacon do
|
6
|
+
let(:current_env) { RVM.current }
|
7
|
+
|
8
|
+
before do
|
9
|
+
@current_dir = Dir.pwd
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be possible to set all rubies" do
|
13
|
+
Bacon.new(:rubies => '1.9.1').rubies.should be == '1.9.1'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should set the rubies" do
|
17
|
+
Bacon.new(:rubies => 'jruby,ree').rubies.should be == 'jruby,ree'
|
18
|
+
end
|
19
|
+
|
20
|
+
it "rubies should be empty when not have rubies" do
|
21
|
+
Bacon.new.rubies.should be_empty
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should set a default test pattern when have none' do
|
25
|
+
Bacon.new.test_pattern.should == 'spec/**/*_spec.rb'
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return false for #pending method" do
|
29
|
+
Bacon.new.pending?.should be_false
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#test_files' do
|
33
|
+
|
34
|
+
let(:bacon) { Bacon.new }
|
35
|
+
|
36
|
+
it "return should include the spec files" do
|
37
|
+
Dir.chdir("#{@current_dir}/spec/factories/buzz") do
|
38
|
+
bacon.test_files.should be == "spec/buzz_spec.rb"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "return should include the spec files to test them" do
|
43
|
+
Dir.chdir("#{@current_dir}/spec/factories/wood") do
|
44
|
+
bacon.test_files.should be == "spec/wood_spec.rb"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it "return should include the spec files to test them in two level of the spec folder" do
|
49
|
+
Dir.chdir("#{@current_dir}/spec/factories/slinky") do
|
50
|
+
bacon.test_files.should be == "spec/slinky/slinky_spec.rb"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#decide_files' do
|
57
|
+
|
58
|
+
before { @bacon = Bacon.new }
|
59
|
+
|
60
|
+
it "should not call the spec file when match pattern" do
|
61
|
+
@bacon.should_not_receive(:test_files)
|
62
|
+
@bacon.decide_files('application_spec.rb')
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should call the spec files when pattern is nil" do
|
66
|
+
@bacon.should_receive(:test_files)
|
67
|
+
@bacon.decide_files(nil)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#handle_results' do
|
73
|
+
|
74
|
+
before do
|
75
|
+
@bacon = Bacon.new
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should handle a example that succeed" do
|
79
|
+
results = "should be true\n\n2 specifications (2 requirements), 0 failures, 0 errors\n"
|
80
|
+
@bacon.parse_results(results)
|
81
|
+
@bacon.message.should == "2 specifications (2 requirements), 0 failures, 0 errors"
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should parse without the terminal ansi color" do
|
85
|
+
results = "should be true\n\n3 specifications (2 requirements), 0 failures, 0 errors\n"
|
86
|
+
@bacon.parse_results(results)
|
87
|
+
@bacon.message.should == "3 specifications (2 requirements), 0 failures, 0 errors"
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should handle a example that succeed and return false for failure?" do
|
91
|
+
results = "3 specifications (2 requirements), 0 failures, 0 errors"
|
92
|
+
@bacon.parse_results(results)
|
93
|
+
@bacon.failure?.should equal false
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should parse without the terminal ansi color and grep the failure" do
|
97
|
+
results = "\n\e[33m3 specifications (2 requirements), 10 failures, 0 errors\e[0m\n"
|
98
|
+
@bacon.parse_results(results)
|
99
|
+
@bacon.failure?.should be_true
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should parse bacon tests errors" do
|
103
|
+
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)"
|
104
|
+
@bacon.parse_results(results)
|
105
|
+
@bacon.message.should == "An exception occurred"
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should parse bacon tests errors" do
|
109
|
+
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)"
|
110
|
+
@bacon.parse_results(results)
|
111
|
+
@bacon.failure?.should be_true
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should parse bacon tests errors" do
|
115
|
+
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)"
|
116
|
+
@bacon.parse_results(results)
|
117
|
+
@bacon.sucess?.should equal false
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '#sucess?' do
|
122
|
+
before { @bacon = Bacon.new }
|
123
|
+
|
124
|
+
it "should return false when have failures" do
|
125
|
+
results = "3 specifications (3 requirements), 3 failures, 0 errors"
|
126
|
+
@bacon.parse_results(results)
|
127
|
+
@bacon.sucess?.should equal false
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should return true when have zero failures and zero pending" do
|
131
|
+
results = "13 specifications (20 requirements), 0 failures, 0 errors"
|
132
|
+
@bacon.parse_results(results)
|
133
|
+
@bacon.sucess?.should be_true
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
describe '#search_bacon' do
|
139
|
+
# humm ... Bacon ... nhame nhame =]
|
140
|
+
|
141
|
+
it "should match bacon in the string" do
|
142
|
+
current_env.should_receive(:path_for).and_return('bacon')
|
143
|
+
Bacon.new.search_bacon(current_env).should match /bacon/
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module InfinityTest
|
4
|
+
module TestLibrary
|
5
|
+
describe Rspec do
|
6
|
+
let(:rspec) { Rspec.new }
|
7
|
+
|
8
|
+
before do
|
9
|
+
@current_dir = Dir.pwd
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be possible to set all rubies" do
|
13
|
+
Rspec.new(:rubies => '1.9.1').rubies.should be == '1.9.1'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should set the rubies" do
|
17
|
+
Rspec.new(:rubies => 'jruby,ree').rubies.should be == 'jruby,ree'
|
18
|
+
end
|
19
|
+
|
20
|
+
it "rubies should be empty when not have rubies" do
|
21
|
+
Rspec.new.rubies.should be_empty
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should set a default test pattern when have none' do
|
25
|
+
Rspec.new.test_pattern.should == 'spec/**/*_spec.rb'
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#test_files' do
|
29
|
+
|
30
|
+
it "return should include the spec files" do
|
31
|
+
buzz_library do
|
32
|
+
rspec.test_files.should be == "spec/buzz_spec.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it "return should include the spec files to test them" do
|
37
|
+
wood_library do
|
38
|
+
rspec.test_files.should be == "spec/wood_spec.rb"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "return should include the spec files to test them in two level of the spec folder" do
|
43
|
+
slinky_library do
|
44
|
+
rspec.test_files.should be == "spec/slinky/slinky_spec.rb"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '#decide_files' do
|
51
|
+
|
52
|
+
before { @rspec = Rspec.new }
|
53
|
+
|
54
|
+
it "should not call the spec file when match pattern" do
|
55
|
+
@rspec.should_not_receive(:test_files)
|
56
|
+
@rspec.decide_files('application_spec.rb')
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should call the spec files when pattern is nil" do
|
60
|
+
@rspec.should_receive(:test_files)
|
61
|
+
@rspec.decide_files(nil)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#handle_results' do
|
67
|
+
|
68
|
+
before do
|
69
|
+
@rspec = Rspec.new
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should handle a example that succeed" do
|
73
|
+
results = "........Finished in 0.299817 seconds\n\n105 examples, 0 failures, 0 pending\n"
|
74
|
+
@rspec.parse_results(results)
|
75
|
+
@rspec.message.should == "105 examples, 0 failures, 0 pending"
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should parse without the terminal ansi color" do
|
79
|
+
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"
|
80
|
+
@rspec.parse_results(results)
|
81
|
+
@rspec.message.should == "406 examples, 5 failures, 2 pending"
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should handle a example that succeed and return false for failure?" do
|
85
|
+
results = "........Finished in 0.299817 seconds\n\n105 examples, 0 failures, 0 pending\n"
|
86
|
+
@rspec.parse_results(results)
|
87
|
+
@rspec.failure?.should equal false
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should parse without the terminal ansi color and grep the failure" do
|
91
|
+
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"
|
92
|
+
@rspec.parse_results(results)
|
93
|
+
@rspec.failure?.should be_true
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should parse without the terminal ansi color and grep the pending" do
|
97
|
+
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"
|
98
|
+
@rspec.parse_results(results)
|
99
|
+
@rspec.pending?.should be_true
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should parse rspec tests errors" do
|
103
|
+
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)"
|
104
|
+
@rspec.parse_results(results)
|
105
|
+
@rspec.message.should == "An exception occurred"
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should parse rspec tests errors" do
|
109
|
+
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)"
|
110
|
+
@rspec.parse_results(results)
|
111
|
+
@rspec.failure?.should be_true
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should parse rspec tests errors" do
|
115
|
+
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)"
|
116
|
+
@rspec.parse_results(results)
|
117
|
+
@rspec.sucess?.should equal false
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should parse rspec tests errors" do
|
121
|
+
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)"
|
122
|
+
@rspec.parse_results(results)
|
123
|
+
@rspec.pending?.should equal false
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe '#sucess?' do
|
128
|
+
before { @rspec = Rspec.new }
|
129
|
+
|
130
|
+
it "should return false when have failures" do
|
131
|
+
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"
|
132
|
+
@rspec.parse_results(results)
|
133
|
+
@rspec.sucess?.should equal false
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should return false when have pending" do
|
137
|
+
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"
|
138
|
+
@rspec.parse_results(results)
|
139
|
+
@rspec.sucess?.should be_false
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should return true when have zero failures and zero pending" do
|
143
|
+
results = "........Finished in 0.299817 seconds\n\n105 examples, 0 failures, 0 pending\n"
|
144
|
+
@rspec.parse_results(results)
|
145
|
+
@rspec.sucess?.should be_true
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
|
150
|
+
describe '#pending?' do
|
151
|
+
let(:rspec) { Rspec.new }
|
152
|
+
|
153
|
+
it "should return true when have pending" do
|
154
|
+
rspec.pending = 1
|
155
|
+
rspec.failures = 0
|
156
|
+
rspec.pending?.should be_true
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should return false when have pending bu thave failures" do
|
160
|
+
rspec.pending = 1
|
161
|
+
rspec.failures = 1
|
162
|
+
rspec.pending?.should equal false
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
describe '#search_files' do
|
168
|
+
|
169
|
+
it "should return all the files the match the pattern" do
|
170
|
+
wood_library do
|
171
|
+
rspec.search_files('wood').should be == "spec/wood_spec.rb"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should return the files match by the pattern" do
|
176
|
+
buzz_library do
|
177
|
+
rspec.search_files('buzz').should be == 'spec/buzz_spec.rb'
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
@@ -0,0 +1,184 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module InfinityTest
|
4
|
+
module TestLibrary
|
5
|
+
describe TestUnit do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@current_dir = Dir.pwd
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be possible to set all rubies" do
|
12
|
+
TestUnit.new(:rubies => 'jruby').rubies.should be == 'jruby'
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should be possible to set any rubies that I want" do
|
16
|
+
TestUnit.new(:rubies => 'ree,1.9.1,1.9.2').rubies.should be == 'ree,1.9.1,1.9.2'
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be empty when not have rubies" do
|
20
|
+
TestUnit.new.rubies.should be == []
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#test_loader" do
|
24
|
+
let(:test_unit) { TestUnit.new }
|
25
|
+
it "should call files to test with test_loader" do
|
26
|
+
Dir.chdir("#{@current_dir}/spec/factories/travel") do
|
27
|
+
test_unit.test_loader.should eql "#{@current_dir}/lib/infinity_test/test_unit_loader.rb"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "should call more than one file to test with test_loader" do
|
32
|
+
|
33
|
+
it "return should include test/company_test.rb" do
|
34
|
+
Dir.chdir("#{@current_dir}/spec/factories/company") do
|
35
|
+
test_unit.all_files.should eql ["test/company_test.rb"]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "return should include more than one file to test" do
|
40
|
+
Dir.chdir("#{@current_dir}/spec/factories/travel") do
|
41
|
+
test_unit.all_files.should eql ["test/partner_test.rb","test/travel_test.rb"]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should include all the tests file" do
|
46
|
+
Dir.chdir("#{@current_dir}/spec/factories/travel") do
|
47
|
+
test_unit.test_files.should include "test/partner_test.rb test/travel_test.rb"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should include test loader" do
|
52
|
+
Dir.chdir("#{@current_dir}/spec/factories/travel") do
|
53
|
+
test_unit.test_files.should include "#{@current_dir}/lib/infinity_test/test_unit_loader.rb"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#parse_results' do
|
61
|
+
|
62
|
+
before do
|
63
|
+
@test_unit = TestUnit.new
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should parse when have all passed" do
|
67
|
+
results = ".....\n3 tests, 3 assertions, 0 failures, 0 errors, 0 skips"
|
68
|
+
@test_unit.parse_results(results)
|
69
|
+
@test_unit.message.should == "3 tests, 3 assertions, 0 failures, 0 errors, 0 skips"
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should parse when have extra message (in Ruby 1.9.*)" do
|
73
|
+
results = "\nFinished in 0.001742 seconds.\n\n3 tests, 3 assertions, 1 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
74
|
+
@test_unit.parse_results(results)
|
75
|
+
@test_unit.message.should == "3 tests, 3 assertions, 1 failures, 1 errors, 1 skips"
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should parse when have a exception" do
|
79
|
+
@test_unit.parse_results("")
|
80
|
+
@test_unit.message.should == "An exception occurred"
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should parse and set correctly the tests" do
|
84
|
+
results = "\nFinished in 0.8981 seconds.\n\n3 tests, 3 assertions, 1 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
85
|
+
@test_unit.parse_results(results)
|
86
|
+
@test_unit.tests.should == 3
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should parse and set correctly the tests" do
|
90
|
+
results = "\nFinished in 0.5678 seconds.\n\n6 tests, 3 assertions, 1 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
91
|
+
@test_unit.parse_results(results)
|
92
|
+
@test_unit.tests.should == 6
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should parse and set correctly the tests" do
|
96
|
+
results = "\nFinished in 0.34678 seconds.\n\n6 tests, 7 assertions, 1 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
97
|
+
@test_unit.parse_results(results)
|
98
|
+
@test_unit.assertions.should == 7
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should parse and set correctly the tests" do
|
102
|
+
results = "\nFinished in 0.8561 seconds.\n\n3 tests, 4 assertions, 1 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
103
|
+
@test_unit.parse_results(results)
|
104
|
+
@test_unit.assertions.should == 4
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should parse and set correctly the tests" do
|
108
|
+
results = "\nFinished in 0.7654 seconds.\n\n6 tests, 3 assertions, 4 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
109
|
+
@test_unit.parse_results(results)
|
110
|
+
@test_unit.failures.should == 4
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should parse and set correctly the tests" do
|
114
|
+
results = "\nFinished in 0.789065 seconds.\n\n6 tests, 3 assertions, 5 failures, 1 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
115
|
+
@test_unit.parse_results(results)
|
116
|
+
@test_unit.failures.should == 5
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should parse and set correctly the tests" do
|
120
|
+
results = "\nFinished in 0.7654 seconds.\n\n6 tests, 3 assertions, 4 failures, 2 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
121
|
+
@test_unit.parse_results(results)
|
122
|
+
@test_unit.errors.should == 2
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should parse and set correctly the tests" do
|
126
|
+
results = "\nFinished in 0.7654 seconds.\n\n36 tests, 37 assertions, 4 failures, 20 errors, 1 skips\n\nTest run options: --seed 18841\n"
|
127
|
+
@test_unit.parse_results(results)
|
128
|
+
@test_unit.errors.should == 20
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should parse when have a exception and set failure to 1" do
|
132
|
+
@test_unit.parse_results("")
|
133
|
+
@test_unit.failures.should == 1
|
134
|
+
@test_unit.tests.should == 1
|
135
|
+
@test_unit.assertions.should == 1
|
136
|
+
@test_unit.errors.should == 1
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
140
|
+
|
141
|
+
describe '#failure?' do
|
142
|
+
|
143
|
+
before do
|
144
|
+
@test_unit = TestUnit.new
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should return true when have failures" do
|
148
|
+
@test_unit.parse_results(".....\n3 tests, 3 assertions, 1 failures, 0 errors, 0 skips")
|
149
|
+
@test_unit.failure?.should be_true
|
150
|
+
end
|
151
|
+
|
152
|
+
it "should return true when have errors" do
|
153
|
+
@test_unit.parse_results(".....\n3 tests, 3 assertions, 0 failures, 4 errors, 0 skips")
|
154
|
+
@test_unit.failure?.should be_true
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should return true when have nothing" do
|
158
|
+
@test_unit.parse_results("")
|
159
|
+
@test_unit.failure?.should be_true
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should return false when have all suceed :) " do
|
163
|
+
@test_unit.parse_results(".....\n3 tests, 3 assertions, 0 failures, 0 errors, 0 skips")
|
164
|
+
@test_unit.failure?.should be_false
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'should return false when have all assertions and tests suceed \o/ ' do
|
168
|
+
@test_unit.parse_results(".....\n4 tests, 7 assertions, 0 failures, 0 errors, 0 skips")
|
169
|
+
@test_unit.failure?.should be_false
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
describe '#pending?' do
|
175
|
+
|
176
|
+
it "should be false" do
|
177
|
+
TestUnit.new.pending?.should equal false
|
178
|
+
end
|
179
|
+
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|