ci_reporter 1.9.3 → 2.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +22 -0
  3. data/.travis.yml +2 -6
  4. data/Gemfile +0 -9
  5. data/History.txt +0 -4
  6. data/LICENSE.txt +23 -21
  7. data/README.md +90 -0
  8. data/Rakefile +5 -99
  9. data/ci_reporter.gemspec +23 -52
  10. data/gemfiles/.gitignore +1 -0
  11. data/lib/ci/reporter/core.rb +0 -4
  12. data/lib/ci/reporter/internal.rb +31 -0
  13. data/lib/ci/reporter/rake/utils.rb +0 -4
  14. data/lib/ci/reporter/report_manager.rb +7 -11
  15. data/lib/ci/reporter/test_suite.rb +1 -9
  16. data/lib/ci/reporter/version.rb +1 -7
  17. data/spec/ci/reporter/output_capture_spec.rb +3 -7
  18. data/spec/ci/reporter/report_manager_spec.rb +6 -10
  19. data/spec/ci/reporter/test_suite_spec.rb +0 -4
  20. data/spec/spec_helper.rb +0 -7
  21. metadata +29 -138
  22. data/.gemtest +0 -0
  23. data/.hoerc +0 -2
  24. data/.travis.before_install.sh +0 -13
  25. data/Manifest.txt +0 -50
  26. data/README.rdoc +0 -111
  27. data/acceptance/cucumber/cucumber_example.feature +0 -19
  28. data/acceptance/cucumber/step_definitions/development_steps.rb +0 -40
  29. data/acceptance/minitest_example_test.rb +0 -17
  30. data/acceptance/rspec_example_spec.rb +0 -24
  31. data/acceptance/spinach/features/spinach_example.feature +0 -24
  32. data/acceptance/spinach/features/steps/example_spinach_feature.rb +0 -34
  33. data/acceptance/test_unit_example_test.rb +0 -23
  34. data/acceptance/verification_spec.rb +0 -185
  35. data/lib/ci/reporter/cucumber.rb +0 -127
  36. data/lib/ci/reporter/minitest.rb +0 -226
  37. data/lib/ci/reporter/rake/cucumber.rb +0 -17
  38. data/lib/ci/reporter/rake/cucumber_loader.rb +0 -6
  39. data/lib/ci/reporter/rake/minitest.rb +0 -15
  40. data/lib/ci/reporter/rake/minitest_loader.rb +0 -9
  41. data/lib/ci/reporter/rake/rspec.rb +0 -31
  42. data/lib/ci/reporter/rake/rspec_loader.rb +0 -6
  43. data/lib/ci/reporter/rake/spinach.rb +0 -19
  44. data/lib/ci/reporter/rake/spinach_loader.rb +0 -5
  45. data/lib/ci/reporter/rake/test_unit.rb +0 -15
  46. data/lib/ci/reporter/rake/test_unit_loader.rb +0 -38
  47. data/lib/ci/reporter/rspec.rb +0 -220
  48. data/lib/ci/reporter/spinach.rb +0 -80
  49. data/lib/ci/reporter/test_unit.rb +0 -163
  50. data/spec/ci/reporter/cucumber_spec.rb +0 -230
  51. data/spec/ci/reporter/rake/rake_tasks_spec.rb +0 -110
  52. data/spec/ci/reporter/rspec_spec.rb +0 -156
  53. data/spec/ci/reporter/test_unit_spec.rb +0 -152
  54. data/stub.rake +0 -16
  55. data/tasks/ci_reporter.rake +0 -20
@@ -1,230 +0,0 @@
1
- # Copyright (c) 2006-2013 Nick Sieger <nicksieger@gmail.com>
2
- # See the file LICENSE.txt included with the distribution for
3
- # software license details.
4
-
5
- require File.dirname(__FILE__) + "/../../spec_helper.rb"
6
- require 'ci/reporter/cucumber'
7
-
8
- describe "The Cucumber reporter" do
9
- describe CI::Reporter::CucumberFailure do
10
- before(:each) do
11
- @klass = double("class")
12
- @klass.stub(:name).and_return("Exception name")
13
-
14
- @exception = double("exception")
15
- @exception.stub(:class).and_return(@klass)
16
- @exception.stub(:message).and_return("Exception message")
17
- @exception.stub(:backtrace).and_return(["First line", "Second line"])
18
-
19
- @step = double("step")
20
- @step.stub(:exception).and_return(@exception)
21
-
22
- @cucumber_failure = CI::Reporter::CucumberFailure.new(@step)
23
- end
24
-
25
- it "should always return true for failure?" do
26
- @cucumber_failure.should be_failure
27
- end
28
-
29
- it "should always return false for error?" do
30
- @cucumber_failure.should_not be_error
31
- end
32
-
33
- it "should propagate the name as the underlying exception's class name" do
34
- @step.should_receive(:exception)
35
- @exception.should_receive(:class)
36
- @klass.should_receive(:name)
37
-
38
- @cucumber_failure.name.should == "Exception name"
39
- end
40
-
41
- it "should propagate the message as the underlying exception's message" do
42
- @step.should_receive(:exception)
43
- @exception.should_receive(:message)
44
-
45
- @cucumber_failure.message.should == "Exception message"
46
- end
47
-
48
- it "should propagate and format the exception's backtrace" do
49
- @step.should_receive(:exception)
50
- @exception.should_receive(:backtrace)
51
-
52
- @cucumber_failure.location.should == "First line\nSecond line"
53
- end
54
- end
55
-
56
- describe CI::Reporter::Cucumber do
57
- before(:each) do
58
- @step_mother = double("step_mother")
59
- @io = double("io")
60
-
61
- @report_manager = double("report_manager")
62
- CI::Reporter::ReportManager.stub(:new).and_return(@report_manager)
63
- end
64
-
65
- def new_instance
66
- CI::Reporter::Cucumber.new(@step_mother, @io, {})
67
- end
68
-
69
- it "should create a new report manager to report on test success/failure" do
70
- CI::Reporter::ReportManager.should_receive(:new)
71
- new_instance
72
- end
73
-
74
- it "should record the feature name when a new feature is visited" do
75
- cucumber = new_instance
76
- cucumber.feature_name(nil, "Some feature name")
77
- cucumber.name.should == "Some feature name"
78
- end
79
-
80
- it "should record only the first line of a feature name" do
81
- cucumber = new_instance
82
- cucumber.feature_name(nil, "Some feature name\nLonger description")
83
- cucumber.name.should == "Some feature name"
84
- end
85
-
86
- context "applied to a feature" do
87
- before(:each) do
88
- @cucumber = new_instance
89
- @cucumber.feature_name(nil, "Demo feature")
90
-
91
- @test_suite = double("test_suite", :start => nil, :finish => nil, :name= => nil)
92
- CI::Reporter::TestSuite.stub(:new).and_return(@test_suite)
93
-
94
- @feature = double("feature")
95
-
96
- @report_manager.stub(:write_report)
97
- end
98
-
99
- context "before" do
100
- it "should create a new test suite" do
101
- CI::Reporter::TestSuite.should_receive(:new).with(/Demo feature/)
102
- @cucumber.before_feature(@feature)
103
- end
104
-
105
- it "should indicate that the test suite has started" do
106
- @test_suite.should_receive(:start)
107
- @cucumber.before_feature(@feature)
108
- end
109
- end
110
-
111
- context "after" do
112
- before :each do
113
- @cucumber = new_instance
114
- @cucumber.feature_name(nil, "Demo feature")
115
-
116
- @test_suite = double("test_suite", :start => nil, :finish => nil, :name= => nil)
117
- CI::Reporter::TestSuite.stub(:new).and_return(@test_suite)
118
-
119
- @feature = double("feature")
120
-
121
- @report_manager.stub(:write_report)
122
-
123
- @cucumber.before_feature(@feature)
124
- end
125
-
126
- it "should indicate that the test suite has finished" do
127
- @test_suite.should_receive(:finish)
128
- @cucumber.after_feature(@feature)
129
- end
130
-
131
- it "should ask the report manager to write a report" do
132
- @report_manager.should_receive(:write_report).with(@test_suite)
133
- @cucumber.after_feature(@feature)
134
- end
135
- end
136
- end
137
-
138
- context "inside a scenario" do
139
- before(:each) do
140
- @testcases = []
141
-
142
- @test_suite = double("test_suite", :testcases => @testcases)
143
-
144
- @cucumber = new_instance
145
- @cucumber.stub(:test_suite).and_return(@test_suite)
146
-
147
- @test_case = double("test_case", :start => nil, :finish => nil, :name => "Step Name")
148
- CI::Reporter::TestCase.stub(:new).and_return(@test_case)
149
-
150
- @step = double("step", :status => :passed)
151
- @step.stub(:name).and_return("Step Name")
152
- end
153
-
154
- context "before steps" do
155
- it "should create a new test case" do
156
- CI::Reporter::TestCase.should_receive(:new).with("Step Name")
157
- @cucumber.scenario_name(nil, "Step Name")
158
- @cucumber.before_steps(@step)
159
- end
160
-
161
- it "should indicate that the test case has started" do
162
- @test_case.should_receive(:start)
163
- @cucumber.before_steps(@step)
164
- end
165
- end
166
-
167
- context "after steps" do
168
- before :each do
169
- @cucumber.before_steps(@step)
170
- end
171
-
172
- it "should indicate that the test case has finished" do
173
- @test_case.should_receive(:finish)
174
- @cucumber.after_steps(@step)
175
- end
176
-
177
- it "should add the test case to the suite's list of cases" do
178
- @testcases.should be_empty
179
- @cucumber.after_steps(@step)
180
- @testcases.should_not be_empty
181
- @testcases.first.should == @test_case
182
- end
183
-
184
- it "should alter the name of a test case that is pending to include '(PENDING)'" do
185
- @step.stub(:status).and_return(:pending)
186
- @test_case.should_receive(:name=).with("Step Name (PENDING)")
187
- @cucumber.after_steps(@step)
188
- end
189
-
190
- it "should alter the name of a test case that is undefined to include '(PENDING)'" do
191
- @step.stub(:status).and_return(:undefined)
192
- @test_case.should_receive(:name=).with("Step Name (PENDING)")
193
- @cucumber.after_steps(@step)
194
- end
195
-
196
- it "should alter the name of a test case that was skipped to include '(SKIPPED)'" do
197
- @step.stub(:status).and_return(:skipped)
198
- @test_case.should_receive(:name=).with("Step Name (SKIPPED)")
199
- @cucumber.after_steps(@step)
200
- end
201
- end
202
-
203
- describe "that fails" do
204
- before(:each) do
205
- @step.stub(:status).and_return(:failed)
206
-
207
- @failures = []
208
- @test_case.stub(:failures).and_return(@failures)
209
-
210
- @cucumber.before_steps(@step)
211
-
212
- @cucumber_failure = double("cucumber_failure")
213
- CI::Reporter::CucumberFailure.stub(:new).and_return(@cucumber_failure)
214
- end
215
-
216
- it "should create a new cucumber failure with that step" do
217
- CI::Reporter::CucumberFailure.should_receive(:new).with(@step)
218
- @cucumber.after_steps(@step)
219
- end
220
-
221
- it "should add the failure to the suite's list of failures" do
222
- @failures.should be_empty
223
- @cucumber.after_steps(@step)
224
- @failures.should_not be_empty
225
- @failures.first.should == @cucumber_failure
226
- end
227
- end
228
- end
229
- end
230
- end
@@ -1,110 +0,0 @@
1
- # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
- # See the file LICENSE.txt included with the distribution for
3
- # software license details.
4
-
5
- require File.dirname(__FILE__) + "/../../../spec_helper.rb"
6
- require 'rake'
7
-
8
- def save_env(v)
9
- ENV["PREV_#{v}"] = ENV[v]
10
- end
11
- def restore_env(v)
12
- ENV[v] = ENV["PREV_#{v}"]
13
- ENV.delete("PREV_#{v}")
14
- end
15
-
16
- describe "ci_reporter ci:setup:testunit task" do
17
- before(:each) do
18
- @rake = Rake::Application.new
19
- Rake.application = @rake
20
- load CI_REPORTER_LIB + '/ci/reporter/rake/test_unit.rb'
21
- save_env "CI_REPORTS"
22
- save_env "TESTOPTS"
23
- ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
24
- end
25
- after(:each) do
26
- restore_env "TESTOPTS"
27
- restore_env "CI_REPORTS"
28
- Rake.application = nil
29
- end
30
-
31
- it "should set ENV['TESTOPTS'] to include test/unit setup file" do
32
- @rake["ci:setup:testunit"].invoke
33
- ENV["TESTOPTS"].should =~ /test_unit_loader/
34
- end
35
-
36
- it "should append to ENV['TESTOPTS'] if it already contains a value" do
37
- ENV["TESTOPTS"] = "somevalue".freeze
38
- @rake["ci:setup:testunit"].invoke
39
- ENV["TESTOPTS"].should =~ /somevalue.*test_unit_loader/
40
- end
41
- end
42
-
43
- describe "ci_reporter ci:setup:rspec task" do
44
- before(:each) do
45
- @rake = Rake::Application.new
46
- Rake.application = @rake
47
- load CI_REPORTER_LIB + '/ci/reporter/rake/rspec.rb'
48
- save_env "CI_REPORTS"
49
- save_env "SPEC_OPTS"
50
- ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
51
- end
52
- after(:each) do
53
- restore_env "SPEC_OPTS"
54
- restore_env "CI_REPORTS"
55
- Rake.application = nil
56
- end
57
-
58
- it "should set ENV['SPEC_OPTS'] to include rspec formatter args" do
59
- @rake["ci:setup:rspec"].invoke
60
- ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
61
- end
62
-
63
- it "should set ENV['SPEC_OPTS'] to include rspec doc formatter if task is ci:setup:rspecdoc" do
64
- @rake["ci:setup:rspecdoc"].invoke
65
- ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpecDoc/
66
- end
67
-
68
- it "should set ENV['SPEC_OPTS'] to include rspec base formatter if task is ci:setup:rspecbase" do
69
- @rake["ci:setup:rspecbase"].invoke
70
- ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpecBase/
71
- end
72
-
73
- it "should append to ENV['SPEC_OPTS'] if it already contains a value" do
74
- ENV["SPEC_OPTS"] = "somevalue".freeze
75
- @rake["ci:setup:rspec"].invoke
76
- ENV["SPEC_OPTS"].should =~ /somevalue.*--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
77
- end
78
- end
79
-
80
- describe "ci_reporter ci:setup:cucumber task" do
81
- before(:each) do
82
- @rake = Rake::Application.new
83
- Rake.application = @rake
84
- load CI_REPORTER_LIB + '/ci/reporter/rake/cucumber.rb'
85
- save_env "CI_REPORTS"
86
- save_env "CUCUMBER_OPTS"
87
- ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
88
- end
89
- after(:each) do
90
- restore_env "CUCUMBER_OPTS"
91
- restore_env "CI_REPORTS"
92
- Rake.application = nil
93
- end
94
-
95
- it "should set ENV['CUCUMBER_OPTS'] to include cucumber formatter args" do
96
- @rake["ci:setup:cucumber"].invoke
97
- ENV["CUCUMBER_OPTS"].should =~ /--format\s+CI::Reporter::Cucumber/
98
- end
99
-
100
- it "should not set ENV['CUCUMBER_OPTS'] to require cucumber_loader" do
101
- @rake["ci:setup:cucumber"].invoke
102
- ENV["CUCUMBER_OPTS"].should_not =~ /.*--require\s+\S*cucumber_loader.*/
103
- end
104
-
105
- it "should append to ENV['CUCUMBER_OPTS'] if it already contains a value" do
106
- ENV["CUCUMBER_OPTS"] = "somevalue".freeze
107
- @rake["ci:setup:cucumber"].invoke
108
- ENV["CUCUMBER_OPTS"].should =~ /somevalue.*\s--format\s+CI::Reporter::Cucumber/
109
- end
110
- end
@@ -1,156 +0,0 @@
1
- # Copyright (c) 2006-2013 Nick Sieger <nicksieger@gmail.com>
2
- # See the file LICENSE.txt included with the distribution for
3
- # software license details.
4
-
5
- require File.dirname(__FILE__) + "/../../spec_helper.rb"
6
- require 'stringio'
7
-
8
- describe "The RSpec reporter" do
9
- before(:each) do
10
- @error = double("error")
11
- @error.stub(:expectation_not_met?).and_return(false)
12
- @error.stub(:pending_fixed?).and_return(false)
13
- @error.stub(:exception).and_return(StandardError.new)
14
- @report_mgr = double("report manager")
15
- @options = double("options")
16
- @args = [@options, StringIO.new("")]
17
- @args.shift unless defined?(::Spec) && ::Spec::VERSION::MAJOR == 1 && ::Spec::VERSION::MINOR >= 1
18
- @fmt = CI::Reporter::RSpec.new *@args
19
- @fmt.report_manager = @report_mgr
20
- @formatter = double("formatter")
21
- @fmt.formatter = @formatter
22
- end
23
-
24
- it "should use a progress bar formatter by default" do
25
- fmt = CI::Reporter::RSpec.new *@args
26
- fmt.formatter.should be_instance_of(CI::Reporter::RSpecFormatters::ProgressFormatter)
27
- end
28
-
29
- it "should use a specdoc formatter for RSpecDoc" do
30
- fmt = CI::Reporter::RSpecDoc.new *@args
31
- fmt.formatter.should be_instance_of(CI::Reporter::RSpecFormatters::DocFormatter)
32
- end
33
-
34
- it "should create a test suite with one success, one failure, and one pending" do
35
- @report_mgr.should_receive(:write_report).and_return do |suite|
36
- suite.testcases.length.should == 3
37
- suite.testcases[0].should_not be_failure
38
- suite.testcases[0].should_not be_error
39
- suite.testcases[1].should be_error
40
- suite.testcases[2].name.should =~ /\(PENDING\)/
41
- end
42
-
43
- example_group = double "example group"
44
- example_group.stub(:description).and_return "A context"
45
-
46
- @formatter.should_receive(:start).with(3)
47
- @formatter.should_receive(:example_group_started).with(example_group)
48
- @formatter.should_receive(:example_started).exactly(3).times
49
- @formatter.should_receive(:example_passed).once
50
- @formatter.should_receive(:example_failed).once
51
- @formatter.should_receive(:example_pending).once
52
- @formatter.should_receive(:start_dump).once
53
- @formatter.should_receive(:dump_failure).once
54
- @formatter.should_receive(:dump_summary).once
55
- @formatter.should_receive(:dump_pending).once
56
- @formatter.should_receive(:dump_failures).once
57
- @formatter.should_receive(:close).once
58
-
59
- @fmt.start(3)
60
- @fmt.example_group_started(example_group)
61
- @fmt.example_started("should pass")
62
- @fmt.example_passed("should pass")
63
- @fmt.example_started("should fail")
64
- @fmt.example_failed("should fail", 1, @error)
65
- @fmt.example_started("should be pending")
66
- @fmt.example_pending("A context", "should be pending", "Not Yet Implemented")
67
- @fmt.start_dump
68
- @fmt.dump_failure(1, double("failure"))
69
- @fmt.dump_summary(0.1, 3, 1, 1)
70
- @fmt.dump_pending
71
- @fmt.close
72
- end
73
-
74
- it "should support RSpec 1.0.8 #add_behavior" do
75
- @formatter.should_receive(:start)
76
- @formatter.should_receive(:add_behaviour).with("A context")
77
- @formatter.should_receive(:example_started).once
78
- @formatter.should_receive(:example_passed).once
79
- @formatter.should_receive(:dump_summary)
80
- @formatter.should_receive(:dump_failures).once
81
- @report_mgr.should_receive(:write_report)
82
-
83
- @fmt.start(2)
84
- @fmt.add_behaviour("A context")
85
- @fmt.example_started("should pass")
86
- @fmt.example_passed("should pass")
87
- @fmt.dump_summary(0.1, 1, 0, 0)
88
- end
89
-
90
- it "should use the example #description method when available" do
91
- group = double "example group"
92
- group.stub(:description).and_return "group description"
93
- example = double "example"
94
- example.stub(:description).and_return "should do something"
95
-
96
- @formatter.should_receive(:start)
97
- @formatter.should_receive(:example_group_started).with(group)
98
- @formatter.should_receive(:example_started).with(example).once
99
- @formatter.should_receive(:example_passed).once
100
- @formatter.should_receive(:dump_summary)
101
- @formatter.should_receive(:dump_failures).once
102
- @report_mgr.should_receive(:write_report).and_return do |suite|
103
- suite.testcases.last.name.should == "should do something"
104
- end
105
-
106
- @fmt.start(2)
107
- @fmt.example_group_started(group)
108
- @fmt.example_started(example)
109
- @fmt.example_passed(example)
110
- @fmt.dump_summary(0.1, 1, 0, 0)
111
- end
112
-
113
- it "should create a test suite with failure in before(:all)" do
114
- example_group = double "example group"
115
- example_group.stub(:description).and_return "A context"
116
-
117
- @formatter.should_receive(:start)
118
- @formatter.should_receive(:example_group_started).with(example_group)
119
- @formatter.should_receive(:example_started).once
120
- @formatter.should_receive(:example_failed).once
121
- @formatter.should_receive(:dump_summary)
122
- @formatter.should_receive(:dump_failures).once
123
- @report_mgr.should_receive(:write_report)
124
-
125
- @fmt.start(2)
126
- @fmt.example_group_started(example_group)
127
- @fmt.example_failed("should fail", 1, @error)
128
- @fmt.dump_summary(0.1, 1, 0, 0)
129
- end
130
-
131
- describe 'RSpec2Failure' do
132
- before(:each) do
133
- @formatter = double "formatter"
134
- @formatter.should_receive(:format_backtrace).and_return("backtrace")
135
- @rspec20_example = double('RSpec2.0 Example',
136
- :execution_result => {:exception_encountered => StandardError.new('rspec2.0 ftw')},
137
- :metadata => {})
138
- @rspec22_example = double('RSpec2.2 Example',
139
- :execution_result => {:exception => StandardError.new('rspec2.2 ftw')},
140
- :metadata => {})
141
- end
142
-
143
- it 'should handle rspec (< 2.2) execution results' do
144
- failure = CI::Reporter::RSpec2Failure.new(@rspec20_example, @formatter)
145
- failure.name.should_not be_nil
146
- failure.message.should == 'rspec2.0 ftw'
147
- failure.location.should_not be_nil
148
- end
149
- it 'should handle rspec (>= 2.2) execution results' do
150
- failure = CI::Reporter::RSpec2Failure.new(@rspec22_example, @formatter)
151
- failure.name.should_not be_nil
152
- failure.message.should == 'rspec2.2 ftw'
153
- failure.location.should_not be_nil
154
- end
155
- end
156
- end