ci_reporter_cucumber 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce760faa0a83602835a97670fa175630aceb45bf
4
- data.tar.gz: 9c394371da2af67f8b0039a1c41291cccdc1d3bb
3
+ metadata.gz: cd4c396df29bf6194a8528abbb74a8dbb2668f35
4
+ data.tar.gz: f91220e91ec7aff8c74108813ab6efbb381e646c
5
5
  SHA512:
6
- metadata.gz: fea4800d2a3b559be342024e64c0cfcadd2ec24b56570b63c3e3a24820549729e0fefc2f169fc085e2c6c1358623d42c96d98879a18c5d4e8e84f492ca7ab575
7
- data.tar.gz: 706d7ea0069db3f5225fc210123c8a5b81260301ce5880a8ff4ceea890bc98a97d04fb3cb6549ba84adf57d6a28619a4379df650ff334aa14180eae27913e605
6
+ metadata.gz: b11188238074ed454bb14011cc257c0723e5e66d55c0f5555cfc7947f85b87310d8b9a1147d60117f3bd4ec970a59f9be50e7e0daa51176ac753162980da3d3c
7
+ data.tar.gz: 4f2d47e2efd71f28501ceb9ec2ebbe86ed40043afc3fc7560dd6f8e0a6eddef569374f4d29819140dacff3e4e2b3a9fb6f77f4fb68ef332fddf64b222835c19d
@@ -1,3 +1,9 @@
1
+ ## 1.0.2 (2015-11-30)
2
+
3
+ Mark skipped test cases as skipped (#9)
4
+
5
+ Add option to mark pending/undefined steps as failures (#10)
6
+
1
7
  ## 1.0.1 (2015-08-09)
2
8
 
3
9
  Fix malformed testcase output w/ Backgrounds (#7)
data/README.md CHANGED
@@ -46,6 +46,10 @@ task :cucumber => 'ci:setup:cucumber'
46
46
 
47
47
  ### Advanced usage
48
48
 
49
+ If you want to treat `undefined` and `pending` steps as failures
50
+ (instead of skipping them), set the `CI_PENDING_IS_FAILURE`
51
+ environment variable to `true`.
52
+
49
53
  Refer to the shared [documentation][ci] for details on setting up
50
54
  CI::Reporter.
51
55
 
@@ -13,6 +13,10 @@ Feature: Example Cucumber feature
13
13
  And I don't bother writing cucumber features
14
14
  Then I should be fired
15
15
 
16
+ Scenario: Forgetful hacker
17
+ Given that I am a forgetful hacker
18
+ And I forgot to define a cucumber step
19
+
16
20
  Scenario: Bad coder
17
21
  Given that I can't code for peanuts
18
22
  And I write step definitions that throw exceptions
@@ -15,8 +15,9 @@ describe "Cucumber acceptance" do
15
15
  subject(:result) { Accessor.new(load_xml_result(report_path)) }
16
16
 
17
17
  it { is_expected.to have(0).errors }
18
+ it { expect(result.skipped_count).to be 1 }
18
19
  it { is_expected.to have(2).failures }
19
- it { is_expected.to have(3).testcases }
20
+ it { is_expected.to have(4).testcases }
20
21
 
21
22
  it_behaves_like "a report with consistent attribute counts"
22
23
  it_behaves_like "assertions are not tracked"
@@ -36,6 +37,12 @@ describe "Cucumber acceptance" do
36
37
  end
37
38
  end
38
39
 
40
+ describe "the test the forgetful hacker wrote" do
41
+ subject(:testcase) { result.testcase('Forgetful hacker (PENDING)') }
42
+
43
+ it { is_expected.to be_skipped }
44
+ end
45
+
39
46
  describe "the test the bad coder wrote" do
40
47
  subject(:testcase) { result.testcase('Bad coder') }
41
48
 
@@ -74,14 +74,24 @@ module CI
74
74
  @test_case.start
75
75
  end
76
76
 
77
+ def treat_pending_as_failure?
78
+ ENV['CI_PENDING_IS_FAILURE'] == 'true'
79
+ end
80
+
77
81
  def after_steps(steps)
78
82
  @test_case.finish
79
83
 
80
84
  case steps.status
81
85
  when :pending, :undefined
82
- @test_case.name = "#{@test_case.name} (PENDING)"
86
+ if treat_pending_as_failure?
87
+ @test_case.failures << CucumberFailure.new(steps)
88
+ else
89
+ @test_case.name = "#{@test_case.name} (PENDING)"
90
+ @test_case.skipped = true
91
+ end
83
92
  when :skipped
84
93
  @test_case.name = "#{@test_case.name} (SKIPPED)"
94
+ @test_case.skipped = true
85
95
  when :failed
86
96
  @test_case.failures << CucumberFailure.new(steps)
87
97
  end
@@ -1,7 +1,7 @@
1
1
  module CI
2
2
  module Reporter
3
3
  class Cucumber
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
6
6
  end
7
7
  end
@@ -106,7 +106,10 @@ module CI::Reporter
106
106
 
107
107
  context "after steps" do
108
108
  before :each do
109
+ allow(cucumber).to receive(:treat_pending_as_failure?).and_return(false)
109
110
  cucumber.before_steps(step)
111
+ allow(test_case).to receive(:name=)
112
+ allow(test_case).to receive(:skipped=)
110
113
  end
111
114
 
112
115
  it "indicates that the test case has finished" do
@@ -121,22 +124,73 @@ module CI::Reporter
121
124
  expect(testcases.first).to eql test_case
122
125
  end
123
126
 
124
- it "alters the name of a test case that is pending to include '(PENDING)'" do
125
- allow(step).to receive(:status).and_return(:pending)
126
- expect(test_case).to receive(:name=).with("Step Name (PENDING)")
127
- cucumber.after_steps(step)
127
+ context "a pending test" do
128
+ before { allow(step).to receive(:status).and_return(:pending) }
129
+
130
+ it "alters the name of a test case that is pending to include '(PENDING)'" do
131
+ expect(test_case).to receive(:name=).with("Step Name (PENDING)")
132
+ cucumber.after_steps(step)
133
+ end
134
+
135
+ it "marks the test case as skipped" do
136
+ expect(test_case).to receive(:skipped=).with(true)
137
+ cucumber.after_steps(step)
138
+ end
128
139
  end
129
140
 
130
- it "alters the name of a test case that is undefined to include '(PENDING)'" do
131
- allow(step).to receive(:status).and_return(:undefined)
132
- expect(test_case).to receive(:name=).with("Step Name (PENDING)")
133
- cucumber.after_steps(step)
141
+ context "an undefined test" do
142
+ before { allow(step).to receive(:status).and_return(:undefined) }
143
+
144
+ it "alters the name of a test case that is undefined to include '(PENDING)'" do
145
+ expect(test_case).to receive(:name=).with("Step Name (PENDING)")
146
+ cucumber.after_steps(step)
147
+ end
148
+
149
+ it "marks the test case as skipped" do
150
+ expect(test_case).to receive(:skipped=).with(true)
151
+ cucumber.after_steps(step)
152
+ end
134
153
  end
135
154
 
136
- it "alter the name of a test case that was skipped to include '(SKIPPED)'" do
137
- allow(step).to receive(:status).and_return(:skipped)
138
- expect(test_case).to receive(:name=).with("Step Name (SKIPPED)")
139
- cucumber.after_steps(step)
155
+ context "a skipped test" do
156
+ before { allow(step).to receive(:status).and_return(:skipped) }
157
+
158
+ it "alters the name of a test case that was skipped to include '(SKIPPED)'" do
159
+ expect(test_case).to receive(:name=).with("Step Name (SKIPPED)")
160
+ cucumber.after_steps(step)
161
+ end
162
+
163
+ it "marks the test case as skipped" do
164
+ expect(test_case).to receive(:skipped=).with(true)
165
+ cucumber.after_steps(step)
166
+ end
167
+ end
168
+
169
+ context "when treating undefined/pending steps as failures" do
170
+ let(:failures) { [] }
171
+ let(:cucumber_failure) { double("cucumber_failure") }
172
+
173
+ before :each do
174
+ allow(cucumber).to receive(:treat_pending_as_failure?).and_return(true)
175
+ allow(test_case).to receive(:failures).and_return(failures)
176
+ allow(CI::Reporter::CucumberFailure).to receive(:new).and_return(cucumber_failure)
177
+ end
178
+
179
+ it "creates a new cucumber failure with a pending step" do
180
+ allow(step).to receive(:status).and_return(:pending)
181
+ expect(failures).to be_empty
182
+ cucumber.after_steps(step)
183
+ expect(failures).to_not be_empty
184
+ expect(failures.first).to eql cucumber_failure
185
+ end
186
+
187
+ it "creates a new cucumber failure with an undefined step" do
188
+ allow(step).to receive(:status).and_return(:undefined)
189
+ expect(failures).to be_empty
190
+ cucumber.after_steps(step)
191
+ expect(failures).to_not be_empty
192
+ expect(failures.first).to eql cucumber_failure
193
+ end
140
194
  end
141
195
  end
142
196
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_reporter_cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sieger
@@ -9,104 +9,104 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-06 00:00:00.000000000 Z
12
+ date: 2015-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: 1.3.3
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.3.3
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: ci_reporter
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '2.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '2.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: bundler
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '1.6'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.6'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ~>
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
76
  version: '3.0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ~>
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '3.0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rspec-collection_matchers
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: ci_reporter_test_utils
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - '>='
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  description:
@@ -117,8 +117,8 @@ executables: []
117
117
  extensions: []
118
118
  extra_rdoc_files: []
119
119
  files:
120
- - .gitignore
121
- - .travis.yml
120
+ - ".gitignore"
121
+ - ".travis.yml"
122
122
  - CHANGELOG.md
123
123
  - Gemfile
124
124
  - LICENSE.txt
@@ -147,17 +147,17 @@ require_paths:
147
147
  - lib
148
148
  required_ruby_version: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  requirements:
155
- - - '>='
155
+ - - ">="
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
159
  rubyforge_project:
160
- rubygems_version: 2.0.14
160
+ rubygems_version: 2.4.8
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Connects CI::Reporter to Cucumber