turnip_formatter 0.0.1

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.
Files changed (50) hide show
  1. data/.gitignore +20 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +3 -0
  5. data/Guardfile +5 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +54 -0
  8. data/Rakefile +1 -0
  9. data/lib/rspec/core/formatters/turnip_formatter.rb +61 -0
  10. data/lib/turnip_formatter/ext/turnip/builder.rb +46 -0
  11. data/lib/turnip_formatter/ext/turnip/rspec.rb +73 -0
  12. data/lib/turnip_formatter/formatter.css +159 -0
  13. data/lib/turnip_formatter/formatter.scss +225 -0
  14. data/lib/turnip_formatter/scenario/failure.rb +47 -0
  15. data/lib/turnip_formatter/scenario/pass.rb +19 -0
  16. data/lib/turnip_formatter/scenario/pending.rb +37 -0
  17. data/lib/turnip_formatter/scenario.rb +63 -0
  18. data/lib/turnip_formatter/step/failure.rb +21 -0
  19. data/lib/turnip_formatter/step/pending.rb +21 -0
  20. data/lib/turnip_formatter/step.rb +18 -0
  21. data/lib/turnip_formatter/template.rb +243 -0
  22. data/lib/turnip_formatter/version.rb +5 -0
  23. data/lib/turnip_formatter.rb +14 -0
  24. data/spec/examples/README.md +124 -0
  25. data/spec/examples/features/battle.feature +36 -0
  26. data/spec/examples/features/battle2.feature +17 -0
  27. data/spec/examples/features/battle3.feature +16 -0
  28. data/spec/examples/features/songs.feature +10 -0
  29. data/spec/examples/images/background.png +0 -0
  30. data/spec/examples/images/basic_step.png +0 -0
  31. data/spec/examples/images/failed_step.png +0 -0
  32. data/spec/examples/images/multiline.png +0 -0
  33. data/spec/examples/images/outline.png +0 -0
  34. data/spec/examples/images/pending_and_tagged_step.png +0 -0
  35. data/spec/examples/spec_helper.rb +8 -0
  36. data/spec/examples/steps/spell_steps.rb +5 -0
  37. data/spec/examples/steps/steps.rb +50 -0
  38. data/spec/rspec/core/formatters/turnip_formatter_spec.rb +101 -0
  39. data/spec/spec_helper.rb +17 -0
  40. data/spec/support/passed.feature +4 -0
  41. data/spec/support/shared_context_examples.rb +17 -0
  42. data/spec/turnip_formatter/scenario/failure_spec.rb +55 -0
  43. data/spec/turnip_formatter/scenario/pass_spec.rb +73 -0
  44. data/spec/turnip_formatter/scenario/pending_spec.rb +60 -0
  45. data/spec/turnip_formatter/step/failure_spec.rb +41 -0
  46. data/spec/turnip_formatter/step/pending_spec.rb +28 -0
  47. data/spec/turnip_formatter/step_spec.rb +32 -0
  48. data/spec/turnip_formatter/template_spec.rb +161 -0
  49. data/turnip_formatter.gemspec +26 -0
  50. metadata +206 -0
@@ -0,0 +1,10 @@
1
+ # Based on turnip/examples
2
+
3
+ Feature: A feature with multiline strings
4
+ Scenario: This is a feature with multiline strings
5
+ When the monster sings the following song
6
+ """
7
+ Oh here be monsters
8
+ This is cool
9
+ """
10
+ Then the song should have 2 lines
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,8 @@
1
+ require 'turnip/rspec'
2
+ require 'turnip_formatter'
3
+
4
+ RSpec.configure do |config|
5
+ config.add_formatter RSpecTurnipFormatter, 'report.html'
6
+ end
7
+
8
+ Dir.glob(File.dirname(__FILE__) + "/steps/**/*steps.rb") { |f| load f, true }
@@ -0,0 +1,5 @@
1
+ steps_for :magician do
2
+ step "I cast a spell 'fireball'" do
3
+ @attack = 3
4
+ end
5
+ end
@@ -0,0 +1,50 @@
1
+ # Based on turnip/examples
2
+
3
+ step "there is a monster" do
4
+ @monster = 1
5
+ end
6
+
7
+ step "there is a strong monster" do
8
+ @monster = 2
9
+ end
10
+
11
+ step "I attack it" do
12
+ @attack ||= 1 # no weapon
13
+ @monster -= @attack
14
+ end
15
+
16
+ step "it should die" do
17
+ expect(@monster).to be <= 0
18
+ end
19
+
20
+ step "Fanfare" do
21
+ end
22
+
23
+ step "I equip a weapon" do
24
+ @attack = 2
25
+ end
26
+
27
+ step "there are monsters:" do |monsters|
28
+ @monsters = monsters.map { |row| row[0] }
29
+ end
30
+
31
+ step "I escape" do
32
+ @escape_result = (@monsters.count <= 2)
33
+ end
34
+
35
+ step "I was able to escape" do
36
+ expect(@escape_result).to be_true
37
+ end
38
+
39
+ step "I could not escape" do
40
+ expect(@escape_result).to be_false
41
+ end
42
+
43
+ step "the monster sings the following song" do |song|
44
+ @song = song
45
+ end
46
+
47
+ step "the song should have :count lines" do |count|
48
+ @song.to_s.split("\n").length.should eq(count.to_i)
49
+ end
50
+
@@ -0,0 +1,101 @@
1
+ require 'spec_helper'
2
+ require 'stringio'
3
+
4
+ module RSpec::Core::Formatters
5
+ describe TurnipFormatter do
6
+ let(:feature) { RSpec::Core::ExampleGroup.describe('Feature') }
7
+ let(:scenario) { feature.describe('Scenario') }
8
+
9
+ let(:scenario_metadata) do
10
+ {
11
+ steps: { descriptions: [], docstrings: [[]], keywords: ['When'], tags: [] },
12
+ file_path: '/path/to/hoge.feature'
13
+ }
14
+ end
15
+
16
+ let(:output) { StringIO.new }
17
+ let(:formatter) { TurnipFormatter.new(output) }
18
+
19
+ describe '#start' do
20
+ it 'should be output header section' do
21
+ formatter.start(0)
22
+ expect(output.string).to match '<!DOCTYPE html>'
23
+ expect(output.string).to match '<div id="main" role="main">'
24
+ end
25
+ end
26
+
27
+ describe '#example_passed' do
28
+ it 'should be output passed scenario section' do
29
+ scenario.example('passed', scenario_metadata) { expect(true).to be_true }
30
+ feature.run(formatter)
31
+
32
+ string = output.string
33
+ expect(string).to match 'class="scenario passed"'
34
+ end
35
+ end
36
+
37
+ describe '#example_failed' do
38
+ let(:failed_metadata) do
39
+ scenario_metadata.dup.tap do |metadata|
40
+ metadata[:steps][:descriptions] << 'this step is error'
41
+ metadata[:steps][:docstrings] << []
42
+ metadata[:steps][:keywords] << 'Given'
43
+ end
44
+ end
45
+
46
+ it 'should be output failed scenario section' do
47
+ scenario.example('failed', failed_metadata) do
48
+ begin
49
+ expect(true).to be_false
50
+ rescue => e
51
+ e.backtrace.push ":in step:0 `"
52
+ raise e
53
+ end
54
+ end
55
+ feature.run(formatter)
56
+ expect(output.string).to match 'class="scenario failed"'
57
+ end
58
+ end
59
+
60
+ describe '#example_pending' do
61
+ let(:pending_metadata) do
62
+ scenario_metadata.dup.tap do |metadata|
63
+ metadata[:steps][:descriptions] << 'this step is unimplement'
64
+ metadata[:steps][:docstrings] << []
65
+ metadata[:steps][:keywords] << 'Given'
66
+ end
67
+ end
68
+
69
+ it 'should be output pending scenario section' do
70
+ scenario.example('pending', pending_metadata) do
71
+ pending("No such step(0): 'this step is unimplement'")
72
+ end
73
+ feature.run(formatter)
74
+
75
+ expect(output.string).to match 'class="scenario pending"'
76
+ end
77
+
78
+ it 'should be output runtime exception section' do
79
+ scenario.example('pending', pending_metadata) do
80
+ pending("Pending")
81
+ end
82
+ feature.run(formatter)
83
+
84
+ expect(output.string).to match 'class="exception"'
85
+ end
86
+ end
87
+
88
+ describe '#dump_summary' do
89
+ it 'should be output summary section' do
90
+ formatter.dump_summary(0.0, 3, 2, 1)
91
+ actual = output.string
92
+
93
+ expect(actual).to match %r{getElementById\("total_count"\).innerHTML = "3";}
94
+ expect(actual).to match %r{getElementById\("failed_count"\).innerHTML = "2";}
95
+ expect(actual).to match %r{getElementById\("pending_count"\).innerHTML = "1";}
96
+ expect(actual).to match %r{getElementById\("total_time"\).innerHTML = "0.0";}
97
+ expect(actual).to match '</html>'
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,17 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
5
+ SimpleCov.start do
6
+ add_filter 'spec/'
7
+ add_filter 'vendor/'
8
+ end
9
+
10
+ require 'turnip_formatter'
11
+ Dir.glob(File.dirname(__FILE__) + "/support/**/*.rb") { |f| require(f) }
12
+
13
+ class NoopObject
14
+ def method_missing(name, *args, &block)
15
+ # nooooooop
16
+ end
17
+ end
@@ -0,0 +1,4 @@
1
+ Feature: Passed Feature
2
+ Scenario: Passed Scenario
3
+ When I do pull request #3
4
+ Then He had ignored my pull request #3
@@ -0,0 +1,17 @@
1
+ shared_context "turnip_formatter scenario setup" do |proc|
2
+ let(:example) do
3
+ group = ::RSpec::Core::ExampleGroup.describe('Feature').describe('Scenario')
4
+ _example = group.example('example', metadata, &proc)
5
+ group.run(NoopObject.new)
6
+ _example
7
+ end
8
+ end
9
+
10
+ shared_context 'turnip_formatter passed scenario metadata' do
11
+ let(:metadata) do
12
+ {
13
+ steps: { descriptions: ['Step 1'], docstrings: [[]], keywords: ['When'], tags: [] },
14
+ file_path: '/path/to/hoge.feature'
15
+ }
16
+ end
17
+ end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ module TurnipFormatter::Scenario
4
+ describe Failure do
5
+ let(:scenario) { ::TurnipFormatter::Scenario::Failure.new(failure_example) }
6
+ include_context 'turnip_formatter passed scenario metadata'
7
+
8
+ context 'Turnip example' do
9
+ include_context 'turnip_formatter scenario setup', proc {
10
+ expect(true).to be_false
11
+ }
12
+
13
+ let(:failure_example) do
14
+ example.exception.backtrace.push ":in step:0 `"
15
+ example
16
+ end
17
+
18
+ describe '#validation' do
19
+ it 'should not raise exception' do
20
+ expect { scenario.validation }.not_to raise_error
21
+ end
22
+ end
23
+ end
24
+
25
+ context 'Not Turnip example' do
26
+ let(:failure_example) do
27
+ example
28
+ end
29
+
30
+ context 'Not failed example' do
31
+ include_context 'turnip_formatter scenario setup', proc {
32
+ expect(true).to be_true
33
+ }
34
+
35
+ describe '#validation' do
36
+ it 'should raise exception' do
37
+ expect { scenario.validation }.to raise_error NotFailedScenarioError
38
+ end
39
+ end
40
+ end
41
+
42
+ context 'Not exist failed step information' do
43
+ include_context 'turnip_formatter scenario setup', proc {
44
+ expect(true).to be_false
45
+ }
46
+
47
+ describe '#validation' do
48
+ it 'should raise exception' do
49
+ expect { scenario.validation }.to raise_error NoExistFailedStepInformationError
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,73 @@
1
+ require 'spec_helper'
2
+
3
+ module TurnipFormatter::Scenario
4
+ describe Pass do
5
+ let(:scenario) { ::TurnipFormatter::Scenario::Pass.new(example) }
6
+
7
+ include_context 'turnip_formatter scenario setup', proc {
8
+ expect(true).to be_true
9
+ }
10
+
11
+ context 'Turnip example' do
12
+ let(:metadata) do
13
+ {
14
+ steps: { descriptions: ['Step 1'], docstrings: [[]], keywords: ['When'], tags: [] },
15
+ file_path: '/path/to/hoge.feature'
16
+ }
17
+ end
18
+
19
+ describe '#validation' do
20
+ it 'should not raise exception' do
21
+ expect { scenario.validation }.not_to raise_error
22
+ end
23
+ end
24
+
25
+ end
26
+
27
+ context 'Not Turnip example' do
28
+ context 'Not passed example' do
29
+ let(:metadata) do
30
+ {
31
+ steps: { descriptions: ['Step 1'], docstrings: [[]], keywords: ['When'], tags: [] },
32
+ file_path: '/path/to/hoge.feature'
33
+ }
34
+ end
35
+
36
+ include_context 'turnip_formatter scenario setup', proc {
37
+ expect(true).to be_false
38
+ }
39
+
40
+ describe '#validation' do
41
+ it 'should raise exception' do
42
+ expect { scenario.validation }.to raise_error NotPassedScenarioError
43
+ end
44
+ end
45
+ end
46
+
47
+ context 'not exist feature file' do
48
+ let(:metadata) do
49
+ {
50
+ steps: { descriptions: ['Step 1'], docstrings: [[]], keywords: ['When'], tags: [] },
51
+ file_path: '/path/to/hoge.rb'
52
+ }
53
+ end
54
+
55
+ describe '#validation' do
56
+ it 'should raise exception' do
57
+ expect { scenario.validation }.to raise_error NoFeatureFileError
58
+ end
59
+ end
60
+ end
61
+
62
+ context 'not exist step information' do
63
+ let(:metadata) { { file_path: '/path/to/hoge.rb' } }
64
+
65
+ describe '#validation' do
66
+ it 'should raise exception' do
67
+ expect { scenario.validation }.to raise_error NotExistStepsInformationError
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ module TurnipFormatter::Scenario
4
+ describe Failure do
5
+ let(:scenario) { ::TurnipFormatter::Scenario::Pending.new(pending_example) }
6
+
7
+ let(:pending_example) do
8
+ example.execution_result[:pending_message] = 'No such step(0): '
9
+ example
10
+ end
11
+
12
+ include_context 'turnip_formatter passed scenario metadata'
13
+
14
+ context 'Turnip example' do
15
+ include_context 'turnip_formatter scenario setup', proc {
16
+ pending('Pending')
17
+ }
18
+
19
+ describe '#validation' do
20
+ it 'should not raise exception' do
21
+ expect { scenario.validation }.not_to raise_error
22
+ end
23
+ end
24
+ end
25
+
26
+ context 'Not Turnip example' do
27
+ let(:failure_example) do
28
+ example
29
+ end
30
+
31
+ context 'Not pending example' do
32
+ include_context 'turnip_formatter scenario setup', proc {
33
+ expect(true).to be_true
34
+ }
35
+
36
+ describe '#validation' do
37
+ it 'should raise exception' do
38
+ expect { scenario.validation }.to raise_error NotPendingScenarioError
39
+ end
40
+ end
41
+ end
42
+
43
+ context 'Not exist pending step information' do
44
+ include_context 'turnip_formatter scenario setup', proc {
45
+ pending('Pending')
46
+ }
47
+
48
+ let(:pending_example) do
49
+ example
50
+ end
51
+
52
+ describe '#validation' do
53
+ it 'should raise exception' do
54
+ expect { scenario.validation }.to raise_error NoExistPendingStepInformationError
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ module TurnipFormatter
4
+ class Step
5
+ describe Failure do
6
+ let(:description) { ['StepName', 'Keyword', ['Docstring']] }
7
+ let(:step) { ::TurnipFormatter::Step.new(description) }
8
+ let(:failure_step) { step.dup.extend TurnipFormatter::Step::Failure }
9
+
10
+ describe '#attention?' do
11
+ subject { failure_step.attention? }
12
+ it { should be_true }
13
+ end
14
+
15
+ describe '#status' do
16
+ subject { failure_step.status }
17
+ it { should eq 'failure' }
18
+ end
19
+
20
+ describe '#attention' do
21
+ it 'should have been implemented' do
22
+ expect(step).not_to respond_to(:attention)
23
+ expect(failure_step).to respond_to(:attention)
24
+ end
25
+
26
+ it 'should set exception informaton' do
27
+ exception = StandardError.new
28
+ expect(exception.backtrace).to be_nil
29
+
30
+ failure_step.attention(exception, ['/path/to/error.rb: 10'])
31
+
32
+ expect(failure_step.docs[:source]).to eq '/path/to/error.rb: 10'
33
+ failure_step.docs[:exception].tap do |e|
34
+ expect(e).to eql(exception)
35
+ expect(e.backtrace.first).to eq '/path/to/error.rb: 10'
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ module TurnipFormatter
4
+ class Step
5
+ describe Failure do
6
+ let(:description) { ['StepName', 'Keyword', ['Docstring']] }
7
+ let(:step) { ::TurnipFormatter::Step.new(description) }
8
+ let(:pending_step) { step.dup.extend TurnipFormatter::Step::Pending }
9
+
10
+ describe '#attention?' do
11
+ subject { pending_step.attention? }
12
+ it { should be_true }
13
+ end
14
+
15
+ describe '#status' do
16
+ subject { pending_step.status }
17
+ it { should eq 'pending' }
18
+ end
19
+
20
+ describe '#attention' do
21
+ it 'should have been implemented' do
22
+ expect(step).not_to respond_to(:attention)
23
+ expect(pending_step).to respond_to(:attention)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ module TurnipFormatter
4
+ describe Step do
5
+ let(:step) { ::TurnipFormatter::Step.new(description) }
6
+ let(:description) { ['StepName', 'Keyword', ['Docstring']] }
7
+
8
+ describe '#attention?' do
9
+ subject { step.attention? }
10
+ it { should be_false }
11
+ end
12
+
13
+ describe '#name' do
14
+ subject { step.name }
15
+ it { should eq('KeywordStepName') }
16
+ end
17
+
18
+ describe '#docs' do
19
+ subject { step.docs }
20
+ it { should include :extra_args }
21
+ end
22
+
23
+ context 'No docstring' do
24
+ let(:description) { ['StepName', 'Keyword', []] }
25
+
26
+ describe '#docs' do
27
+ subject { step.docs }
28
+ it { should_not include :extra_args }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,161 @@
1
+ require 'spec_helper'
2
+
3
+ module TurnipFormatter
4
+ describe Template do
5
+ let(:template) { ::TurnipFormatter::Template.new }
6
+
7
+ context 'Step has no tag' do
8
+ describe '#scenario_tags' do
9
+ let(:scenario) do
10
+ scenario = double('scenario')
11
+ scenario.stub(:tags).and_return([])
12
+ scenario
13
+ end
14
+
15
+ it 'should get null string' do
16
+ expect(template.send(:scenario_tags, scenario)).to be_empty
17
+ end
18
+ end
19
+ end
20
+
21
+ context 'Step has tags' do
22
+ describe '#scenario_tags' do
23
+ let(:scenario) do
24
+ scenario = double('scenario')
25
+ scenario.stub(:tags).and_return(['hoge', 'fuga'])
26
+ scenario
27
+ end
28
+
29
+ it 'should get null string' do
30
+ html = template.send(:scenario_tags, scenario)
31
+ expect(html).to match %r{ul class="tags"}
32
+ expect(html).to match %r{<li>@hoge</li>[[:space:]]+<li>@fuga</li>}
33
+ end
34
+ end
35
+ end
36
+
37
+ describe '#step_attr' do
38
+ let(:passed_step) do
39
+ step = double
40
+ step.stub(:attention?).and_return(false)
41
+ step.should_not_receive(:status)
42
+ step
43
+ end
44
+
45
+ let(:failed_step) do
46
+ step = double
47
+ step.stub(:attention?).and_return(true)
48
+ step.should_receive(:status) { 'failed' }
49
+ step
50
+ end
51
+
52
+ it 'should get tag attribute string' do
53
+ expect(template.send(:step_attr, passed_step)).to eq('class="step"')
54
+ expect(template.send(:step_attr, failed_step)).to eq('class="step failed"')
55
+ end
56
+ end
57
+
58
+ context 'Step has arguments' do
59
+ describe '#step_args' do
60
+ let(:template_stub) do
61
+ template.stub(:step_extra_args).and_return('extra_args')
62
+ template.stub(:step_source).and_return('source')
63
+ template.stub(:step_exception).and_return('exception')
64
+ template
65
+ end
66
+
67
+ let(:step) do
68
+ step = double
69
+ step.stub(:docs).and_return(extra_args: 'a', source: 'b', exception: 'c')
70
+ step
71
+ end
72
+
73
+ it 'should call corresponding method in step' do
74
+ expect(template_stub.send(:step_args, step)).to eq("extra_args\nsource\nexception")
75
+ end
76
+ end
77
+ end
78
+
79
+ context 'Step has no argument' do
80
+ describe '#step_args' do
81
+ let(:template_stub) do
82
+ template.should_not_receive(:step_extra_args)
83
+ template.should_not_receive(:step_source)
84
+ template.should_not_receive(:step_exception)
85
+ template
86
+ end
87
+
88
+ let(:step) do
89
+ step = double
90
+ step.stub(:docs).and_return({})
91
+ step
92
+ end
93
+
94
+ it 'should get null string' do
95
+ expect(template_stub.send(:step_args, step)).to be_empty
96
+ end
97
+ end
98
+ end
99
+
100
+ describe '#step_extra_args' do
101
+ let(:template_stub) do
102
+ template.tap do |t|
103
+ template.stub(:step_outline).and_return('outline')
104
+ template.stub(:step_multiline).and_return('multiline')
105
+ end
106
+ end
107
+
108
+ let(:extra_args_1) do
109
+ [::Turnip::Table.new([['a']]), 'b']
110
+ end
111
+
112
+ let(:extra_args_2) do
113
+ []
114
+ end
115
+
116
+ it 'should get string converted from extra_args' do
117
+ expect(template_stub.send(:step_extra_args, extra_args_1)).to eq("outline\nmultiline")
118
+ expect(template_stub.send(:step_extra_args, extra_args_2)).to be_empty
119
+ end
120
+ end
121
+
122
+ describe '#step_outline' do
123
+ let(:outline) {
124
+ ::Turnip::Table.new([
125
+ ["State", "Money"],
126
+ ["<Tokushima>", "555"],
127
+ ["<Okinawa>", "368"]
128
+ ])
129
+ }
130
+
131
+ it 'should get string converted to <table>' do
132
+ html = template.send(:step_outline, outline)
133
+ expect(html).to match %r{<td>State</td>[[:space:]]+<td>Money</td>}
134
+ expect(html).to match %r{<td>&lt;Tokushima&gt;</td>[[:space:]]+<td>555</td>}
135
+ expect(html).to match %r{<td>&lt;Okinawa&gt;</td>[[:space:]]+<td>368</td>}
136
+ end
137
+ end
138
+
139
+ describe '#step_multiline' do
140
+ it 'should get escaped string enclosed in <pre>' do
141
+ html = template.send(:step_multiline, 'a<a>a')
142
+ expect(html).to eq('<pre class="multiline">a&lt;a&gt;a</pre>')
143
+ end
144
+ end
145
+
146
+ describe '#step_exception' do
147
+ let(:exception) do
148
+ StandardError.new('StepExceptionError').tap do |e|
149
+ e.set_backtrace('/path/to/error.rb: 10')
150
+ end
151
+ end
152
+
153
+ it 'should get string Exception class name and backtrace' do
154
+ html = template.send(:step_exception, exception)
155
+ expect(html).to match %r{div class="step_exception"}
156
+ expect(html).to match %r{<pre>.*#{exception.message}.*</pre>}
157
+ expect(html).to match %r{<li>/path/to/error.rb: 10</li>}
158
+ end
159
+ end
160
+ end
161
+ end