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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f8621af1f4f10c1d79cc179059ade67809e222d
4
- data.tar.gz: 7b11ed4cee5665a49ea8710f39d17c458a9f0158
3
+ metadata.gz: 195374f593f8a0a948c425c5b30846125ce713c2
4
+ data.tar.gz: 5062b23635c5b9bcbda2a3c58997b3cee708836e
5
5
  SHA512:
6
- metadata.gz: fbbc44cc9b341da339e7319c91bfa78a4c553a45ce861c6987a9daa96af50082e69d12350b2140572e4b16dca13fee7c97204fc6884693221dae660dd618d23e
7
- data.tar.gz: 8cf4ebefef3f777077e7d5a503dd1c4dc7b7c6969f374af77e2fdbc5bc270ce86483fe65e6970a5601fc414961a8bd7366ae99a36aa8d886f692cbb981cfe355
6
+ metadata.gz: 497aa307340cf60835a20d682fb8fb9d165b4de27292ea7620422397e56d0be6ebe55e8bef2a7b5a88340802a272994b8c62961d820b47c1bfb35fc48bfeae62
7
+ data.tar.gz: dcf3718d91084ab6d4115208426c8036ed357c78c6bae0f73606ee7bfa719069f4f9d3aaddbe9fbb3b3cfbfd515aeacb425cb2ef752f0e338fb758a31064975e
data/README.md CHANGED
@@ -12,7 +12,7 @@ Requirements
12
12
  --------------------
13
13
 
14
14
  * Ruby
15
- * `2.0.0` or later
15
+ * `2.1.0` or later
16
16
 
17
17
  Installation
18
18
  --------------------
@@ -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.tags + scenario.tags).uniq
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
- (step.extra_args.length + templates.length) > 0
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
- def print_out(args)
10
- return '' if args.nil?
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
- args.map do |arg|
13
- if arg.instance_of?(Turnip::Table)
14
- render_template(:step_outline, { table: arg.to_a })
15
- else
16
- render_template(:step_multiline, { lines: arg })
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, :extra_args
7
+ attr_reader :name, :example, :argument
8
8
  attr_accessor :status
9
9
 
10
- def_delegators :@raw, :extra_args, :line, :keyword, :description
10
+ def_delegators :@raw, :argument, :line, :keyword, :description
11
11
 
12
12
  #
13
13
  # @param [RSpec::Core::Example] example
14
- # @param [Turnip::Builder::Step] raw
14
+ # @param [Turnip::Node::Step] raw
15
15
  #
16
16
  def initialize(example, raw)
17
17
  @example = example
@@ -2,5 +2,5 @@ div class="step #{step.status}"
2
2
  .step-title= step.name
3
3
  - if has_args_or_documents
4
4
  div.step-body
5
- == TurnipFormatter::Printer::StepExtraArgs.print_out(step.extra_args)
5
+ == TurnipFormatter::Printer::StepExtraArgs.print_out(step.argument)
6
6
  == step_docs
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module TurnipFormatter
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.0-beta.1'
5
5
  end
@@ -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: [Turnip::Builder::Step.new('Step 1', [], 1, 'When')],
52
+ steps: [create_step_node('Step', 'Step 1', 1)],
41
53
  tags: []
42
54
  }
43
55
  }
@@ -22,6 +22,6 @@ module StepHelper
22
22
  end
23
23
 
24
24
  def step_description
25
- Turnip::Builder::Step.new('StepName', ['Docstring'], 1, 'Keyword')
25
+ create_step_node('Keyword', 'StepName', 1)
26
26
  end
27
27
  end
@@ -13,7 +13,7 @@ module TurnipFormatter::Printer
13
13
  ])
14
14
  end
15
15
 
16
- subject { StepExtraArgs.print_out([string]) }
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>&lt;Tokushima&gt;</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([string]) }
27
+ subject { StepExtraArgs.print_out(string) }
28
28
  it { should match %r{<pre class="multiline">a&lt;a&gt;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(:extra_args).and_return([])
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(:extra_args).and_return([table])
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
- Turnip::Builder::Step.new('Step 1', [], 1, 'When'),
13
- Turnip::Builder::Step.new('Step 2', [], 3, 'When'),
14
- Turnip::Builder::Step.new('Step 3', [], 10, 'When'), # failed line
15
- Turnip::Builder::Step.new('Step 4', [], 11, 'When'),
16
- Turnip::Builder::Step.new('Step 5', [], 12, 'When')
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
- Turnip::Builder::Step.new('Step 1', [], 1, 'When'),
13
- Turnip::Builder::Step.new('Step 2', [], 3, 'When'),
14
- Turnip::Builder::Step.new('Step 3', [], 10, 'When'), # pending line
15
- Turnip::Builder::Step.new('Step 4', [], 11, 'When'),
16
- Turnip::Builder::Step.new('Step 5', [], 12, 'When')
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
  }
@@ -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', '~> 2.1.0'
21
+ spec.add_dependency 'turnip', '~> 3.0.0.pre.beta'
22
22
  spec.add_dependency 'slim'
23
- spec.add_dependency 'rspec', [">=3.0", "<4.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.5.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-03-10 00:00:00.000000000 Z
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: 2.1.0
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: 2.1.0
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: '4.0'
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: '4.0'
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: '0'
239
+ version: 1.3.1
254
240
  requirements: []
255
241
  rubyforge_project:
256
- rubygems_version: 2.4.5
242
+ rubygems_version: 2.5.1
257
243
  signing_key:
258
244
  specification_version: 4
259
245
  summary: RSpec custom formatter for Turnip