turnip_formatter 0.5.0 → 0.6.0.pre.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/turnip_formatter/ext/turnip/rspec.rb +1 -1
- data/lib/turnip_formatter/printer/step.rb +1 -2
- data/lib/turnip_formatter/printer/step_extra_args.rb +10 -9
- data/lib/turnip_formatter/step.rb +3 -3
- data/lib/turnip_formatter/template/step.slim +1 -1
- data/lib/turnip_formatter/version.rb +1 -1
- data/spec/support/example_helper.rb +13 -1
- data/spec/support/step_helper.rb +1 -1
- data/spec/turnip_formatter/printer/step_extra_args_spec.rb +2 -2
- data/spec/turnip_formatter/printer/step_spec.rb +5 -3
- data/spec/turnip_formatter/scenario/failure_spec.rb +5 -5
- data/spec/turnip_formatter/scenario/pending_spec.rb +5 -5
- data/turnip_formatter.gemspec +2 -3
- metadata +9 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 195374f593f8a0a948c425c5b30846125ce713c2
|
4
|
+
data.tar.gz: 5062b23635c5b9bcbda2a3c58997b3cee708836e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 497aa307340cf60835a20d682fb8fb9d165b4de27292ea7620422397e56d0be6ebe55e8bef2a7b5a88340802a272994b8c62961d820b47c1bfb35fc48bfeae62
|
7
|
+
data.tar.gz: dcf3718d91084ab6d4115208426c8036ed357c78c6bae0f73606ee7bfa719069f4f9d3aaddbe9fbb3b3cfbfd515aeacb425cb2ef752f0e338fb758a31064975e
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ module Turnip
|
|
27
27
|
feature.scenarios.zip(examples).each do |scenario, parent_example|
|
28
28
|
example = parent_example.examples.first
|
29
29
|
steps = background_steps + scenario.steps
|
30
|
-
tags = (feature.
|
30
|
+
tags = (feature.tag_names + scenario.tag_names).uniq
|
31
31
|
|
32
32
|
example.metadata[:turnip_formatter] = { steps: steps, tags: tags }
|
33
33
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'turnip_formatter/printer'
|
2
|
-
require 'turnip_formatter/printer/step_extra_args'
|
3
2
|
|
4
3
|
module TurnipFormatter
|
5
4
|
module Printer
|
@@ -22,7 +21,7 @@ module TurnipFormatter
|
|
22
21
|
private
|
23
22
|
|
24
23
|
def has_args_or_documents?(step, templates)
|
25
|
-
|
24
|
+
step.argument || (templates.length > 0)
|
26
25
|
end
|
27
26
|
|
28
27
|
def documents(step, templates)
|
@@ -6,16 +6,17 @@ module TurnipFormatter
|
|
6
6
|
class << self
|
7
7
|
include TurnipFormatter::Printer
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
#
|
10
|
+
# @param [nil or String or Turnip::Table] Step argument
|
11
|
+
#
|
12
|
+
def print_out(argument)
|
13
|
+
return '' if argument.nil?
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
end.join
|
15
|
+
if argument.instance_of?(Turnip::Table)
|
16
|
+
render_template(:step_outline, { table: argument.to_a })
|
17
|
+
else
|
18
|
+
render_template(:step_multiline, { lines: argument })
|
19
|
+
end
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -4,14 +4,14 @@ module TurnipFormatter
|
|
4
4
|
class Step
|
5
5
|
extend Forwardable
|
6
6
|
|
7
|
-
attr_reader :name, :example, :
|
7
|
+
attr_reader :name, :example, :argument
|
8
8
|
attr_accessor :status
|
9
9
|
|
10
|
-
def_delegators :@raw, :
|
10
|
+
def_delegators :@raw, :argument, :line, :keyword, :description
|
11
11
|
|
12
12
|
#
|
13
13
|
# @param [RSpec::Core::Example] example
|
14
|
-
# @param [Turnip::
|
14
|
+
# @param [Turnip::Node::Step] raw
|
15
15
|
#
|
16
16
|
def initialize(example, raw)
|
17
17
|
@example = example
|
@@ -20,6 +20,18 @@ module ExampleHelper
|
|
20
20
|
example
|
21
21
|
end
|
22
22
|
|
23
|
+
def create_step_node(keyword, text, line)
|
24
|
+
step_metadata = {
|
25
|
+
type: :Step,
|
26
|
+
location: { line: line, column: 1 },
|
27
|
+
keyword: keyword,
|
28
|
+
text: text,
|
29
|
+
argument: nil
|
30
|
+
}
|
31
|
+
|
32
|
+
Turnip::Node::Step.new(step_metadata)
|
33
|
+
end
|
34
|
+
|
23
35
|
private
|
24
36
|
|
25
37
|
def base_example(&assertion)
|
@@ -37,7 +49,7 @@ module ExampleHelper
|
|
37
49
|
def example_metadata
|
38
50
|
{
|
39
51
|
turnip_formatter: {
|
40
|
-
steps: [
|
52
|
+
steps: [create_step_node('Step', 'Step 1', 1)],
|
41
53
|
tags: []
|
42
54
|
}
|
43
55
|
}
|
data/spec/support/step_helper.rb
CHANGED
@@ -13,7 +13,7 @@ module TurnipFormatter::Printer
|
|
13
13
|
])
|
14
14
|
end
|
15
15
|
|
16
|
-
subject { StepExtraArgs.print_out(
|
16
|
+
subject { StepExtraArgs.print_out(string) }
|
17
17
|
|
18
18
|
it { should match %r{<td>State</td>[[:space:]]*<td>Money</td>} }
|
19
19
|
it { should match %r{<td><Tokushima></td>[[:space:]]*<td>555</td>} }
|
@@ -24,7 +24,7 @@ module TurnipFormatter::Printer
|
|
24
24
|
context 'String' do
|
25
25
|
describe '.print_out' do
|
26
26
|
let(:string) { 'a<a>a' }
|
27
|
-
subject { StepExtraArgs.print_out(
|
27
|
+
subject { StepExtraArgs.print_out(string) }
|
28
28
|
it { should match %r{<pre class="multiline">a<a>a</pre>} }
|
29
29
|
end
|
30
30
|
end
|
@@ -8,7 +8,7 @@ describe TurnipFormatter::Printer::Step do
|
|
8
8
|
context 'not has extra argument' do
|
9
9
|
let(:step) do
|
10
10
|
step = passed_step
|
11
|
-
expect(step).to receive(:
|
11
|
+
expect(step).to receive(:argument).and_return(nil)
|
12
12
|
step
|
13
13
|
end
|
14
14
|
|
@@ -23,7 +23,7 @@ describe TurnipFormatter::Printer::Step do
|
|
23
23
|
|
24
24
|
let(:step) do
|
25
25
|
step = passed_step
|
26
|
-
allow(step).to receive(:
|
26
|
+
allow(step).to receive(:argument).and_return(table)
|
27
27
|
step
|
28
28
|
end
|
29
29
|
|
@@ -35,7 +35,9 @@ describe TurnipFormatter::Printer::Step do
|
|
35
35
|
|
36
36
|
context 'has outline argument' do
|
37
37
|
let(:step) do
|
38
|
-
passed_step
|
38
|
+
step = passed_step
|
39
|
+
allow(step).to receive(:argument).and_return('DocString')
|
40
|
+
step
|
39
41
|
end
|
40
42
|
|
41
43
|
it {
|
@@ -9,11 +9,11 @@ describe TurnipFormatter::Scenario::Failure do
|
|
9
9
|
example = failed_example
|
10
10
|
example.metadata[:turnip_formatter] = {
|
11
11
|
steps: [
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
create_step_node('When', 'Step 1', 1),
|
13
|
+
create_step_node('When', 'Step 2', 3),
|
14
|
+
create_step_node('When', 'Step 3', 10), # failed line
|
15
|
+
create_step_node('When', 'Step 4', 11),
|
16
|
+
create_step_node('When', 'Step 5', 12)
|
17
17
|
],
|
18
18
|
tags: []
|
19
19
|
}
|
@@ -9,11 +9,11 @@ describe TurnipFormatter::Scenario::Pending do
|
|
9
9
|
example = pending_example
|
10
10
|
example.metadata[:turnip_formatter] = {
|
11
11
|
steps: [
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
create_step_node('When', 'Step 1', 1),
|
13
|
+
create_step_node('When', 'Step 2', 3),
|
14
|
+
create_step_node('When', 'Step 3', 10), # pending line
|
15
|
+
create_step_node('When', 'Step 4', 11),
|
16
|
+
create_step_node('When', 'Step 5', 12)
|
17
17
|
],
|
18
18
|
tags: []
|
19
19
|
}
|
data/turnip_formatter.gemspec
CHANGED
@@ -18,13 +18,12 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^spec/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'turnip', '~>
|
21
|
+
spec.add_dependency 'turnip', '~> 3.0.0.pre.beta'
|
22
22
|
spec.add_dependency 'slim'
|
23
|
-
spec.add_dependency 'rspec', [">=3.0", "<
|
23
|
+
spec.add_dependency 'rspec', [">=3.0", "<3.5"]
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
25
|
spec.add_development_dependency 'rake'
|
26
26
|
spec.add_development_dependency 'coveralls'
|
27
|
-
spec.add_development_dependency 'guard-rspec'
|
28
27
|
spec.add_development_dependency 'sass'
|
29
28
|
spec.add_development_dependency 'bootstrap-sass'
|
30
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turnip_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0.pre.beta.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wataru MIYAGUNI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: turnip
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.0.pre.beta
|
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
|
-
version:
|
26
|
+
version: 3.0.0.pre.beta
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: slim
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: '3.0'
|
48
48
|
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
50
|
+
version: '3.5'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: '3.0'
|
58
58
|
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '3.5'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: bundler
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,20 +100,6 @@ dependencies:
|
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: guard-rspec
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - ">="
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
117
103
|
- !ruby/object:Gem::Dependency
|
118
104
|
name: sass
|
119
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,12 +234,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
248
234
|
version: '0'
|
249
235
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
250
236
|
requirements:
|
251
|
-
- - "
|
237
|
+
- - ">"
|
252
238
|
- !ruby/object:Gem::Version
|
253
|
-
version:
|
239
|
+
version: 1.3.1
|
254
240
|
requirements: []
|
255
241
|
rubyforge_project:
|
256
|
-
rubygems_version: 2.
|
242
|
+
rubygems_version: 2.5.1
|
257
243
|
signing_key:
|
258
244
|
specification_version: 4
|
259
245
|
summary: RSpec custom formatter for Turnip
|