turnip_documentation_formatter 0.0.1 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Gemfile.lock +23 -42
- data/README.md +11 -1
- data/lib/turnip_documentation_formatter/version.rb +1 -1
- data/lib/turnip_documentation_formatter.rb +0 -1
- data/turnip-documentation-formatter.gemspec +1 -1
- metadata +5 -6
- data/lib/turnip_documentation_formatter/turnip_extension.rb +0 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d53cdcd22ed895e13bb235ce93d832edca4ceb0cadfd3839fa374648c3d15a2
|
4
|
+
data.tar.gz: b7505b5b44825cbdd747044ca6eabbca54bbf41fb12b305012b10bc8758c0e78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7d89e5f8e419016ca8f050c31825ed2213552dc2fb72688a290ae6c0cc1f33e74d77ddd4d9009fcbbc384619c39e025785e85e4dec25782616ced0958186e09
|
7
|
+
data.tar.gz: ff8b6aed5ee1cc43c0232d5caef2a098db86e6f0300afc57d9475a4b81e921ca9947dd1525b94b53162a17529d4e4cf38869e0b227cdaa068bfd80dc2a77d404
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,55 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
turnip_documentation_formatter (0.
|
5
|
-
|
4
|
+
turnip_documentation_formatter (0.1)
|
5
|
+
rspec (~> 3.10)
|
6
|
+
turnip (~> 4.4)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
concurrent-ruby (1.1.9)
|
17
|
-
cucumber-gherkin (14.2.0)
|
18
|
-
cucumber-messages (~> 12.4, >= 12.4.0)
|
19
|
-
cucumber-messages (12.4.0)
|
20
|
-
protobuf-cucumber (~> 3.10, >= 3.10.8)
|
21
|
-
diff-lcs (1.4.4)
|
22
|
-
i18n (1.8.11)
|
23
|
-
concurrent-ruby (~> 1.0)
|
24
|
-
middleware (0.1.0)
|
25
|
-
minitest (5.14.4)
|
26
|
-
protobuf-cucumber (3.10.8)
|
27
|
-
activesupport (>= 3.2)
|
28
|
-
middleware
|
29
|
-
thor
|
30
|
-
thread_safe
|
11
|
+
cucumber-gherkin (24.1.0)
|
12
|
+
cucumber-messages (~> 19.1, >= 19.1.4)
|
13
|
+
cucumber-messages (19.1.4)
|
14
|
+
cuke_modeler (3.17.0)
|
15
|
+
cucumber-gherkin (< 25.0)
|
16
|
+
diff-lcs (1.5.0)
|
31
17
|
rake (13.0.6)
|
32
|
-
rspec (3.
|
33
|
-
rspec-core (~> 3.
|
34
|
-
rspec-expectations (~> 3.
|
35
|
-
rspec-mocks (~> 3.
|
36
|
-
rspec-core (3.
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-expectations (3.
|
18
|
+
rspec (3.12.0)
|
19
|
+
rspec-core (~> 3.12.0)
|
20
|
+
rspec-expectations (~> 3.12.0)
|
21
|
+
rspec-mocks (~> 3.12.0)
|
22
|
+
rspec-core (3.12.0)
|
23
|
+
rspec-support (~> 3.12.0)
|
24
|
+
rspec-expectations (3.12.0)
|
39
25
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-mocks (3.
|
26
|
+
rspec-support (~> 3.12.0)
|
27
|
+
rspec-mocks (3.12.0)
|
42
28
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-support (3.
|
45
|
-
|
46
|
-
|
47
|
-
turnip (4.3.0)
|
48
|
-
cucumber-gherkin (~> 14.0)
|
29
|
+
rspec-support (~> 3.12.0)
|
30
|
+
rspec-support (3.12.0)
|
31
|
+
turnip (4.4.0)
|
32
|
+
cuke_modeler (~> 3.15)
|
49
33
|
rspec (>= 3.0, < 4.0)
|
50
|
-
tzinfo (2.0.4)
|
51
|
-
concurrent-ruby (~> 1.0)
|
52
|
-
zeitwerk (2.5.1)
|
53
34
|
|
54
35
|
PLATFORMS
|
55
36
|
x86_64-linux
|
@@ -60,4 +41,4 @@ DEPENDENCIES
|
|
60
41
|
turnip_documentation_formatter!
|
61
42
|
|
62
43
|
BUNDLED WITH
|
63
|
-
2.2.
|
44
|
+
2.2.25
|
data/README.md
CHANGED
@@ -4,6 +4,10 @@ This gem extends the default RSpec documentation formatter for [Turnip](https://
|
|
4
4
|
|
5
5
|
This makes it easier to see on exactly which step an error occured.
|
6
6
|
|
7
|
+
## Screenshot
|
8
|
+
|
9
|
+
![Before example](https://user-images.githubusercontent.com/242972/81497557-779c7900-92e9-11ea-919f-d4d714540267.png)
|
10
|
+
|
7
11
|
## Installation
|
8
12
|
|
9
13
|
Add this line to your application's Gemfile:
|
@@ -19,6 +23,12 @@ And then execute:
|
|
19
23
|
Or install it yourself as:
|
20
24
|
|
21
25
|
$ gem install turnip_documentation_formatter
|
26
|
+
|
27
|
+
And require the formatter in `spec_helper.rb`:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require "turnip_documentation_formatter"
|
31
|
+
```
|
22
32
|
|
23
33
|
## Usage
|
24
34
|
|
@@ -32,7 +42,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
42
|
|
33
43
|
## Contributing
|
34
44
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
45
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/aramvisser/turnip-documentation-formatter.
|
36
46
|
|
37
47
|
## License
|
38
48
|
|
@@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
|
-
spec.add_runtime_dependency "turnip", "~> 4.
|
27
|
+
spec.add_runtime_dependency "turnip", "~> 4.4"
|
28
28
|
spec.add_runtime_dependency "rspec", "~> 3.10"
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turnip_documentation_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aram Visser
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-01 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: '4.
|
19
|
+
version: '4.4'
|
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: '4.
|
26
|
+
version: '4.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,7 +57,6 @@ files:
|
|
57
57
|
- bin/setup
|
58
58
|
- examples/documentation_formatter.feature
|
59
59
|
- lib/turnip_documentation_formatter.rb
|
60
|
-
- lib/turnip_documentation_formatter/turnip_extension.rb
|
61
60
|
- lib/turnip_documentation_formatter/version.rb
|
62
61
|
- turnip-documentation-formatter.gemspec
|
63
62
|
homepage:
|
@@ -80,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
79
|
- !ruby/object:Gem::Version
|
81
80
|
version: '0'
|
82
81
|
requirements: []
|
83
|
-
rubygems_version: 3.2.
|
82
|
+
rubygems_version: 3.2.26
|
84
83
|
signing_key:
|
85
84
|
specification_version: 4
|
86
85
|
summary: RSpec documentation formatter for Turnip
|
@@ -1,89 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Turnip::RSpec
|
4
|
-
module Execute
|
5
|
-
def run_step(feature_file, step)
|
6
|
-
reporter = ::RSpec.current_example.reporter
|
7
|
-
reporter.publish(:step_started, { step: step })
|
8
|
-
|
9
|
-
begin
|
10
|
-
instance_eval <<-EOS, feature_file, step.line
|
11
|
-
step(step)
|
12
|
-
EOS
|
13
|
-
rescue Turnip::Pending => e
|
14
|
-
reporter.publish(:step_pending, { step: step })
|
15
|
-
|
16
|
-
example = ::RSpec.current_example
|
17
|
-
example.metadata[:line_number] = step.line
|
18
|
-
example.metadata[:location] = "#{example.metadata[:file_path]}:#{step.line}"
|
19
|
-
|
20
|
-
if ::RSpec.configuration.raise_error_for_unimplemented_steps
|
21
|
-
e.backtrace.push "#{feature_file}:#{step.line}:in `#{step.description}'"
|
22
|
-
raise
|
23
|
-
end
|
24
|
-
|
25
|
-
skip("No such step: '#{e}'")
|
26
|
-
rescue StandardError, ::RSpec::Expectations::ExpectationNotMetError => e
|
27
|
-
reporter.publish(:step_failed, { step: step })
|
28
|
-
|
29
|
-
e.backtrace.push "#{feature_file}:#{step.line}:in `#{step.description}'"
|
30
|
-
raise e
|
31
|
-
end
|
32
|
-
|
33
|
-
reporter.publish(:step_passed, { step: step })
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
class << self
|
38
|
-
def run(feature_file)
|
39
|
-
feature = Turnip::Builder.build(feature_file)
|
40
|
-
|
41
|
-
return nil if feature.nil?
|
42
|
-
|
43
|
-
instance_eval <<-EOS, feature_file, feature.line
|
44
|
-
context = ::RSpec.describe feature.name, feature.metadata_hash
|
45
|
-
run_scenario_group(context, feature, feature_file)
|
46
|
-
EOS
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
#
|
52
|
-
# @param [RSpec::ExampleGroups] context
|
53
|
-
# @param [Turnip::Node::Feature|Turnip::Node::Rule] group
|
54
|
-
# @param [String] filename
|
55
|
-
#
|
56
|
-
def run_scenario_group(context, group, filename)
|
57
|
-
background_steps = group.backgrounds.map(&:steps).flatten
|
58
|
-
|
59
|
-
context.before do
|
60
|
-
background_steps.each do |step|
|
61
|
-
run_step(filename, step)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
group.scenarios.each do |scenario|
|
66
|
-
all_steps = background_steps + scenario.steps
|
67
|
-
description = all_steps.map(&:to_s).join(' -> ')
|
68
|
-
metadata = scenario.metadata_hash.merge(turnip_steps: all_steps)
|
69
|
-
|
70
|
-
context.describe scenario.name, metadata do
|
71
|
-
instance_eval <<-EOS, filename, scenario.line
|
72
|
-
it description do
|
73
|
-
scenario.steps.each do |step|
|
74
|
-
run_step(filename, step)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
EOS
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
if group.is_a?(Turnip::Node::Feature)
|
82
|
-
group.rules.each do |rule|
|
83
|
-
rule_context = context.context(rule.name, { turnip: true })
|
84
|
-
run_scenario_group(rule_context, rule, filename)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|