turnip_formatter 0.2.10 → 0.2.11

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: b232d3ff5dd4b35bdf672d74c0758e00a0554390
4
- data.tar.gz: a292275ebee0accd42fe09620c7da71cbb42e9d0
3
+ metadata.gz: f797fdd3e324fcc850739157c99e215f89d78768
4
+ data.tar.gz: b94ada02b2acbfad137e314c1986adaa075caaab
5
5
  SHA512:
6
- metadata.gz: 47c557ea23de721b993689ad1464e45264e715f587b7b3e2f8c3cc13d84aa5c18bdc8cdf900452f297e8b765cea144dee1e251ac80ac2c2dc4d4cb0524e3b36c
7
- data.tar.gz: 464ff1082a6e1653a7a322d3320771d96b0502235328779acbb972a6a03b829f8ef0443418dee627634e4e38a3ff4bdbd67c6cec7526020871b16e8cc21921e8
6
+ metadata.gz: e6ee2cd266e8d3dd14180b3d11cd4fd0631733236cd92f3833dd43d186ec216d292a16cfce55e281df95a5b95b4526feae511518e57dfc3ab2c209f242cc9166
7
+ data.tar.gz: f32b416e146f53f70f5c993a9959ad0a72495845b1b6b68b03710333336856c3bf155c9e9ef4814dd74fd5c2249d9c36835e9b70664df0e5d74702e8933cb74d
@@ -4,11 +4,11 @@ module Escape
4
4
  end
5
5
 
6
6
  step "I was able to escape" do
7
- expect(@escape_result).to be_true
7
+ expect(@escape_result).to be true
8
8
  end
9
9
 
10
10
  step "I could not escape" do
11
- expect(@escape_result).to be_false
11
+ expect(@escape_result).to be false
12
12
  end
13
13
  end
14
14
 
@@ -23,7 +23,7 @@ module Turnip
23
23
  end
24
24
  end
25
25
 
26
- class Step1 < Struct.new(:description, :extra_args, :line, :keyword, :tags)
26
+ class Step1 < Struct.new(:description, :extra_args, :line, :keyword)
27
27
  def split(*args)
28
28
  self.to_s.split(*args)
29
29
  end
@@ -38,7 +38,8 @@ module Turnip
38
38
  if step.doc_string
39
39
  extra_args.push step.doc_string.value
40
40
  elsif step.rows
41
- extra_args.push Turnip::Table.new(step.rows.map { |row| row.cells(&:value) })
41
+ table = Turnip::Table.new(step.rows.map(&:cells).map(&:to_a))
42
+ extra_args.push(table)
42
43
  end
43
44
  @current_step_context.steps << Step1.new(step.name, extra_args, step.line, step.keyword)
44
45
  end
@@ -6,11 +6,13 @@ module Turnip
6
6
  module RSpec
7
7
  module Execute
8
8
  def run_step(feature_file, step, index)
9
+ example = Turnip::RSpec.fetch_current_example(self)
10
+
9
11
  begin
10
12
  step(step)
11
- rescue Turnip::Pending
13
+ rescue Turnip::Pending => e
12
14
  example.metadata[:line_number] = step.line
13
- pending("No such step(#{index}): '#{step}'")
15
+ pending("No such step(#{index}): '#{e}'")
14
16
  rescue StandardError => e
15
17
  example.metadata[:line_number] = step.line
16
18
  e.backtrace.push "#{feature_file}:#{step.line}:in step:#{index} `#{step.description}'"
@@ -19,6 +21,8 @@ module Turnip
19
21
  end
20
22
 
21
23
  def push_scenario_metadata(scenario)
24
+ example = Turnip::RSpec.fetch_current_example(self)
25
+
22
26
  steps = scenario.steps
23
27
  example.metadata[:turnip_formatter].tap do |turnip|
24
28
  steps.each do |step|
@@ -46,8 +50,12 @@ module Turnip
46
50
  end
47
51
 
48
52
  before do
53
+ example = Turnip::RSpec.fetch_current_example(self)
54
+
49
55
  example.metadata[:file_path] = feature_file
50
- example.metadata[:turnip_formatter] = { steps: [], tags: feature.tags }
56
+ example.metadata[:turnip_formatter] = {
57
+ steps: [], tags: feature.tags
58
+ }
51
59
 
52
60
  backgrounds.each do |background|
53
61
  push_scenario_metadata(background)
@@ -59,17 +67,19 @@ module Turnip
59
67
  end
60
68
 
61
69
  feature.scenarios.each do |scenario|
62
- describe scenario.name, scenario.metadata_hash do
63
- before do
64
- push_scenario_metadata(scenario)
65
- end
70
+ instance_eval <<-EOS, feature_file, scenario.line
71
+ describe scenario.name, scenario.metadata_hash do
72
+ before do
73
+ push_scenario_metadata(scenario)
74
+ end
66
75
 
67
- it scenario.steps.map(&:description).join(' -> ') do
68
- scenario.steps.each.with_index(background_steps.size) do |step, index|
69
- run_step(feature_file, step, index)
76
+ it scenario.steps.map(&:description).join(' -> ') do
77
+ scenario.steps.each.with_index(background_steps.size) do |step, index|
78
+ run_step(feature_file, step, index)
79
+ end
70
80
  end
71
81
  end
72
- end
82
+ EOS
73
83
  end
74
84
  end
75
85
  end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module TurnipFormatter
4
- VERSION = "0.2.10"
4
+ VERSION = "0.2.11"
5
5
  end
@@ -18,7 +18,7 @@ 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', '~> 1.2.0'
22
22
  spec.add_dependency 'sass'
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turnip_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wataru MIYAGUNI
@@ -14,16 +14,16 @@ dependencies:
14
14
  name: turnip
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.2.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
- version: '0'
26
+ version: 1.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sass
29
29
  requirement: !ruby/object:Gem::Requirement