turnip_formatter 0.2.9 → 0.2.10
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 +4 -4
- data/.travis.yml +1 -0
- data/lib/turnip_formatter/step.rb +4 -2
- data/lib/turnip_formatter/version.rb +1 -1
- data/spec/rspec/core/formatters/turnip_formatter_spec.rb +14 -14
- data/spec/support/shared_context_examples.rb +2 -2
- data/spec/turnip_formatter/printer/scenario_spec.rb +2 -2
- data/spec/turnip_formatter/printer/step_extra_args_spec.rb +1 -1
- data/spec/turnip_formatter/printer/step_spec.rb +7 -7
- data/spec/turnip_formatter/printer/tab_feature_statistics_spec.rb +3 -3
- data/spec/turnip_formatter/printer/tab_speed_statistics_spec.rb +3 -3
- data/spec/turnip_formatter/printer/tab_tag_statistics_spec.rb +12 -12
- data/spec/turnip_formatter/step/failure_spec.rb +1 -1
- data/spec/turnip_formatter/step/pending_spec.rb +1 -1
- data/spec/turnip_formatter/step_spec.rb +1 -1
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b232d3ff5dd4b35bdf672d74c0758e00a0554390
|
4
|
+
data.tar.gz: a292275ebee0accd42fe09620c7da71cbb42e9d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47c557ea23de721b993689ad1464e45264e715f587b7b3e2f8c3cc13d84aa5c18bdc8cdf900452f297e8b765cea144dee1e251ac80ac2c2dc4d4cb0524e3b36c
|
7
|
+
data.tar.gz: 464ff1082a6e1653a7a322d3320771d96b0502235328779acbb972a6a03b829f8ef0443418dee627634e4e38a3ff4bdbd67c6cec7526020871b16e8cc21921e8
|
data/.travis.yml
CHANGED
@@ -15,8 +15,10 @@ module TurnipFormatter
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def remove_template(status, klass)
|
18
|
-
|
19
|
-
|
18
|
+
key = status.to_sym
|
19
|
+
return unless templates.key?(key)
|
20
|
+
templates[key].delete(klass)
|
21
|
+
templates.delete(key) if templates[key].empty?
|
20
22
|
end
|
21
23
|
|
22
24
|
def status
|
@@ -12,15 +12,15 @@ module RSpec::Core::Formatters
|
|
12
12
|
|
13
13
|
describe '#example_passed' do
|
14
14
|
before do
|
15
|
-
scenario.example('passed', metadata) { expect(true).to
|
15
|
+
scenario.example('passed', metadata) { expect(true).to be true }
|
16
16
|
feature.run(formatter)
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should get passed scenario count' do
|
20
|
-
expect(formatter.passed_scenarios).to
|
21
|
-
expect(formatter.failed_scenarios).to
|
22
|
-
expect(formatter.pending_scenarios).to
|
23
|
-
expect(formatter.scenarios).to
|
20
|
+
expect(formatter.passed_scenarios.size).to eq 1
|
21
|
+
expect(formatter.failed_scenarios.size).to eq 0
|
22
|
+
expect(formatter.pending_scenarios.size).to eq 0
|
23
|
+
expect(formatter.scenarios.size).to eq 1
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -28,7 +28,7 @@ module RSpec::Core::Formatters
|
|
28
28
|
before do
|
29
29
|
scenario.example('failed', metadata) do
|
30
30
|
begin
|
31
|
-
expect(true).to
|
31
|
+
expect(true).to be false
|
32
32
|
rescue => e
|
33
33
|
e.backtrace.push ":in step:0 `"
|
34
34
|
raise e
|
@@ -38,10 +38,10 @@ module RSpec::Core::Formatters
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'should get failed scenario count' do
|
41
|
-
expect(formatter.passed_scenarios).to
|
42
|
-
expect(formatter.failed_scenarios).to
|
43
|
-
expect(formatter.pending_scenarios).to
|
44
|
-
expect(formatter.scenarios).to
|
41
|
+
expect(formatter.passed_scenarios.size).to eq 0
|
42
|
+
expect(formatter.failed_scenarios.size).to eq 1
|
43
|
+
expect(formatter.pending_scenarios.size).to eq 0
|
44
|
+
expect(formatter.scenarios.size).to eq 1
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -54,10 +54,10 @@ module RSpec::Core::Formatters
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'should get pending scenario count' do
|
57
|
-
expect(formatter.passed_scenarios).to
|
58
|
-
expect(formatter.failed_scenarios).to
|
59
|
-
expect(formatter.pending_scenarios).to
|
60
|
-
expect(formatter.scenarios).to
|
57
|
+
expect(formatter.passed_scenarios.size).to eq 0
|
58
|
+
expect(formatter.failed_scenarios.size).to eq 0
|
59
|
+
expect(formatter.pending_scenarios.size).to eq 1
|
60
|
+
expect(formatter.scenarios.size).to eq 1
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
shared_context "turnip_formatter scenario setup" do |assertion|
|
2
2
|
let(:example) do
|
3
|
-
assertion ||= proc { expect(true).to
|
3
|
+
assertion ||= proc { expect(true).to be true }
|
4
4
|
group = ::RSpec::Core::ExampleGroup.describe('Feature').describe('Scenario')
|
5
5
|
example = group.example('example', metadata, &assertion)
|
6
6
|
group.run(NoopObject.new)
|
@@ -10,7 +10,7 @@ end
|
|
10
10
|
|
11
11
|
shared_context "turnip_formatter failure scenario setup" do |assertion|
|
12
12
|
include_context 'turnip_formatter scenario setup', proc {
|
13
|
-
expect(true).to
|
13
|
+
expect(true).to be false
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
@@ -25,8 +25,8 @@ module TurnipFormatter::Printer
|
|
25
25
|
context 'not turnip example' do
|
26
26
|
describe '.print_out' do
|
27
27
|
before do
|
28
|
-
scenario.
|
29
|
-
RuntimeError.
|
28
|
+
allow(scenario).to receive(:validation) { raise NoFeatureFileError }
|
29
|
+
expect(RuntimeError).to receive(:print_out)
|
30
30
|
end
|
31
31
|
|
32
32
|
it { Scenario.print_out(scenario) }
|
@@ -16,7 +16,7 @@ module TurnipFormatter::Printer
|
|
16
16
|
subject { StepExtraArgs.print_out([string]) }
|
17
17
|
|
18
18
|
it {
|
19
|
-
subject.
|
19
|
+
expect(subject).to have_tag 'table.step_outline' do
|
20
20
|
with_tag 'tr:nth-child(1) td:nth-child(1)', text: 'State'
|
21
21
|
with_tag 'tr:nth-child(1) td:nth-child(2)', text: 'Money'
|
22
22
|
|
@@ -23,9 +23,9 @@ module TurnipFormatter::Printer
|
|
23
23
|
end
|
24
24
|
|
25
25
|
before do
|
26
|
-
StepExtraArgs.
|
27
|
-
source_style.
|
28
|
-
exception_style.
|
26
|
+
expect(StepExtraArgs).to receive(:print_out).with(['a', table]).and_return('extra_args')
|
27
|
+
expect(source_style).to receive(:build).with('b').and_return('source')
|
28
|
+
expect(exception_style).to receive(:build).with('c').and_return('exception')
|
29
29
|
end
|
30
30
|
|
31
31
|
it { should have_tag 'div.args', text: "extra_args\nsource\nexception" }
|
@@ -60,7 +60,7 @@ module TurnipFormatter::Printer
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'should call corresponding method in step' do
|
63
|
-
subject.
|
63
|
+
expect(subject).to have_tag 'div.args' do
|
64
64
|
with_tag 'em', text: 'aiueo'
|
65
65
|
with_tag 'strong', text: '12345'
|
66
66
|
end
|
@@ -76,9 +76,9 @@ module TurnipFormatter::Printer
|
|
76
76
|
end
|
77
77
|
|
78
78
|
before do
|
79
|
-
StepExtraArgs.
|
80
|
-
source_style.
|
81
|
-
exception_style.
|
79
|
+
expect(StepExtraArgs).not_to receive(:print_out)
|
80
|
+
expect(source_style).not_to receive(:build)
|
81
|
+
expect(exception_style).not_to receive(:build)
|
82
82
|
end
|
83
83
|
|
84
84
|
it { should have_tag 'div.args', text: '' }
|
@@ -19,7 +19,7 @@ module TurnipFormatter::Printer
|
|
19
19
|
# Feature: Hago (passed:2 failed:0, pending:0)
|
20
20
|
['passed', 'passed'].map do |status|
|
21
21
|
scenario = base_scenario.dup
|
22
|
-
scenario.
|
22
|
+
allow(scenario).to receive(:status).and_return(status)
|
23
23
|
scenario
|
24
24
|
end
|
25
25
|
end
|
@@ -41,7 +41,7 @@ module TurnipFormatter::Printer
|
|
41
41
|
# Feature: Hoge (passed:1 failed:2, pending:0)
|
42
42
|
['passed', 'failed', 'failed'].map do |status|
|
43
43
|
scenario = base_scenario.dup
|
44
|
-
scenario.
|
44
|
+
allow(scenario).to receive(:status).and_return(status)
|
45
45
|
scenario
|
46
46
|
end
|
47
47
|
end
|
@@ -63,7 +63,7 @@ module TurnipFormatter::Printer
|
|
63
63
|
# Feature: Fuga (passed:1 failed:0, pending:1)
|
64
64
|
['passed', 'pending'].map do |status|
|
65
65
|
scenario = base_scenario.dup
|
66
|
-
scenario.
|
66
|
+
allow(scenario).to receive(:status).and_return(status)
|
67
67
|
scenario
|
68
68
|
end
|
69
69
|
end
|
@@ -13,7 +13,7 @@ module TurnipFormatter::Printer
|
|
13
13
|
let :passed_scenarios do
|
14
14
|
([example] * 3).map do |ex|
|
15
15
|
TurnipFormatter::Scenario::Pass.new(ex)
|
16
|
-
end.each { |s| s.
|
16
|
+
end.each { |s| allow(s).to receive(:run_time).and_return(rand) }
|
17
17
|
end
|
18
18
|
|
19
19
|
describe '.print_out' do
|
@@ -21,7 +21,7 @@ module TurnipFormatter::Printer
|
|
21
21
|
html = statistics.print_out(passed_scenarios)
|
22
22
|
|
23
23
|
passed_scenarios.sort { |a,b| a.run_time <=> b.run_time }.each.with_index(1) do |scenario, index|
|
24
|
-
html.
|
24
|
+
expect(html).to have_tag "tbody tr:nth-child(#{index})" do
|
25
25
|
with_tag 'td:nth-child(1) span', text: scenario.feature_name
|
26
26
|
with_tag "td:nth-child(2) a[href='\##{scenario.id}']", text: scenario.name
|
27
27
|
with_tag 'td:nth-child(3) span', text: scenario.run_time
|
@@ -33,7 +33,7 @@ module TurnipFormatter::Printer
|
|
33
33
|
describe '.speed_analysis' do
|
34
34
|
it 'should get array of scenario order by run_time' do
|
35
35
|
scenarios = statistics.send(:speed_analysis, passed_scenarios)
|
36
|
-
expect(scenarios).to
|
36
|
+
expect(scenarios.size).to eq 3
|
37
37
|
|
38
38
|
run_time_list = scenarios.map(&:run_time)
|
39
39
|
expect(run_time_list.sort).to eq run_time_list
|
@@ -22,30 +22,30 @@ module TurnipFormatter::Printer
|
|
22
22
|
|
23
23
|
# Failed scenario have tags @hoge and @fuga
|
24
24
|
scenario = base_scenario.dup
|
25
|
-
scenario.
|
26
|
-
scenario.
|
27
|
-
scenario.
|
25
|
+
allow(scenario).to receive(:tags).and_return(['foo', 'bar'])
|
26
|
+
allow(scenario).to receive(:validation).and_return(true)
|
27
|
+
allow(scenario).to receive(:status).and_return('failed')
|
28
28
|
scenarios << scenario
|
29
29
|
|
30
30
|
# Passed scenario no have tags
|
31
31
|
scenario = base_scenario.dup
|
32
|
-
scenario.
|
33
|
-
scenario.
|
34
|
-
scenario.
|
32
|
+
allow(scenario).to receive(:tags).and_return([])
|
33
|
+
allow(scenario).to receive(:validation).and_return(true)
|
34
|
+
allow(scenario).to receive(:status).and_return('passed')
|
35
35
|
scenarios << scenario
|
36
36
|
|
37
37
|
# Passed scenario have tags @hoge
|
38
38
|
scenario = base_scenario.dup
|
39
|
-
scenario.
|
40
|
-
scenario.
|
41
|
-
scenario.
|
39
|
+
allow(scenario).to receive(:tags).and_return(['hoge'])
|
40
|
+
allow(scenario).to receive(:validation).and_return(true)
|
41
|
+
allow(scenario).to receive(:status).and_return('passed')
|
42
42
|
scenarios << scenario
|
43
43
|
|
44
44
|
# Pending scenario have tags @fuga and @hago
|
45
45
|
scenario = base_scenario.dup
|
46
|
-
scenario.
|
47
|
-
scenario.
|
48
|
-
scenario.
|
46
|
+
allow(scenario).to receive(:tags).and_return(['bar', 'hoge'])
|
47
|
+
allow(scenario).to receive(:validation).and_return(true)
|
48
|
+
allow(scenario).to receive(:status).and_return('pending')
|
49
49
|
scenarios << scenario
|
50
50
|
end
|
51
51
|
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turnip_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wataru MIYAGUNI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: turnip
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sass
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec-html-matchers
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: coveralls
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: guard-rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: RSpec custom formatter for Turnip
|
@@ -115,9 +115,9 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
- .gitignore
|
119
|
-
- .rspec
|
120
|
-
- .travis.yml
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".travis.yml"
|
121
121
|
- Gemfile
|
122
122
|
- Guardfile
|
123
123
|
- LICENSE.txt
|
@@ -216,17 +216,17 @@ require_paths:
|
|
216
216
|
- lib
|
217
217
|
required_ruby_version: !ruby/object:Gem::Requirement
|
218
218
|
requirements:
|
219
|
-
- -
|
219
|
+
- - ">="
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
223
|
requirements:
|
224
|
-
- -
|
224
|
+
- - ">="
|
225
225
|
- !ruby/object:Gem::Version
|
226
226
|
version: '0'
|
227
227
|
requirements: []
|
228
228
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.0
|
229
|
+
rubygems_version: 2.2.0
|
230
230
|
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: RSpec custom formatter for Turnip
|