gurke 2.3.0 → 2.4.0
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.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/features/gurke/context_in_hooks.feature +39 -0
- data/features/gurke/run_specific_scenarios.feature +1 -1
- data/features/gurke/step_specific_definitions.feature +1 -1
- data/features/support/steps/cli_steps.rb +2 -2
- data/features/support/steps/file_steps.rb +1 -0
- data/lib/gurke/configuration.rb +32 -7
- data/lib/gurke/feature.rb +1 -1
- data/lib/gurke/feature_list.rb +1 -1
- data/lib/gurke/runner.rb +4 -4
- data/lib/gurke/scenario.rb +1 -1
- data/lib/gurke/step.rb +1 -1
- data/lib/gurke/step_definition.rb +2 -2
- data/lib/gurke/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cd784fe71ce083826f06bc56a0c2688468a85ef
|
4
|
+
data.tar.gz: e18151208f931bd806513d2be7639221a0e59325
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac6c0e0c475b508ac69fcb3632e0f2b402fc3db9664f0d9783fa9bdd00be4c880733be1cc1382ce36edaae3a355f892ea8cc2e33f199ff033d5a80e0c02a40a9
|
7
|
+
data.tar.gz: 535e2ddbfee0a1f991c1fe60929c3a546f634fcd23741422bfe42f99e6dd43e061ad7039e0fc3d95b4553a359de45ba6216616a3fb02fa1e7ccf6563305f034e
|
data/README.md
CHANGED
@@ -4,9 +4,7 @@
|
|
4
4
|
|
5
5
|
**Gurke** is an experimental, alternative cucumber runner. It ~~steals~~ borrows ideas and concepts from [turnip](https://github.com/jnicklas/turnip), [rspec](http://rspec.info) and tries to avoid [cucumber](https://github.com/cucumber/cucumber/).
|
6
6
|
|
7
|
-
That includes * Step definitions in modules * Before, After and Around hooks * Formatters * Partial step inclusion (via modules) *
|
8
|
-
|
9
|
-
But still **Gurke** is unfinished, not recommended and highly dangerous!
|
7
|
+
That includes * Step definitions in modules * Before, After and Around hooks * Formatters * Partial step inclusion (via modules) * Keyword-dependent steps * Scenario-local world * Running DRb background test server.
|
10
8
|
|
11
9
|
## Installation
|
12
10
|
|
@@ -158,7 +156,7 @@ You can also specify a list of files that will be run:
|
|
158
156
|
gurke features/my_feature.feature
|
159
157
|
```
|
160
158
|
|
161
|
-
If you append one or more line numbers - separated by
|
159
|
+
If you append one or more line numbers - separated by colons - only the scenarios defined around the given lines will be run:
|
162
160
|
|
163
161
|
```
|
164
162
|
gurke features/my_feature.feature:14:34
|
@@ -185,13 +183,15 @@ Remember to restart background server when changing hooks, configuration or remo
|
|
185
183
|
## TODO
|
186
184
|
|
187
185
|
* Add `context`/`ctx` object to world providing current feature/scenario/step
|
188
|
-
*
|
186
|
+
* Define scenario specific after hook in a step (e.g. to close opened resource)
|
189
187
|
* Random run order (rspec)
|
190
188
|
* Using strings with placeholders as step pattern (turnip)
|
191
189
|
* Custom placeholders (turnip)
|
192
|
-
* Define scenario specific after hook in a step (e.g. to close opened resource)
|
193
190
|
* More reporters (NyanCat / JUnit / TeamCity / Adapter to run multiple reporters)
|
194
191
|
* SimpleCov support (and use it in own tests)
|
192
|
+
* Scope hooks by scenario tags
|
193
|
+
* Fast-fail
|
194
|
+
* Additional feature-scope and global worlds
|
195
195
|
|
196
196
|
## History
|
197
197
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Feature: Access context in hooks
|
2
|
+
In order to setup specific things
|
3
|
+
As a developer
|
4
|
+
I want to access meta data of the context in hooks
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I am in a project using gurke
|
8
|
+
And a file "features/test.feature" with the following content exists
|
9
|
+
"""
|
10
|
+
Feature: A
|
11
|
+
@tag
|
12
|
+
Scenario: A
|
13
|
+
Then the scenario has tag "tag"
|
14
|
+
|
15
|
+
"""
|
16
|
+
And a file "features/support/steps/test_steps.rb" with the following content exists
|
17
|
+
"""
|
18
|
+
require 'test/unit/assertions'
|
19
|
+
|
20
|
+
module TestSteps
|
21
|
+
include Test::Unit::Assertions
|
22
|
+
|
23
|
+
Then("the scenario has tag \"tag\"") do
|
24
|
+
assert @before_tags.include? "tag"
|
25
|
+
assert @around_tags.include? "tag"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
Gurke.configure do |c|
|
30
|
+
c.include TestSteps
|
31
|
+
|
32
|
+
c.before(:each) { |s| @before_tags = s.tags }
|
33
|
+
c.around(:each) { |s| @around_tags = s.tags; s.call }
|
34
|
+
end
|
35
|
+
"""
|
36
|
+
|
37
|
+
Scenario: Assertions should pass
|
38
|
+
When I execute all scenarios
|
39
|
+
Then all scenarios have passed
|
@@ -27,13 +27,13 @@ module CLISteps
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def _cli_include_content(content)
|
30
|
-
expect(@last_process[1]).to include content
|
30
|
+
expect(@last_process[1] + @last_process[2]).to include content
|
31
31
|
end
|
32
32
|
|
33
33
|
step(/the program output should include "(.*?)"/, :_cli_include_content)
|
34
34
|
|
35
35
|
def _cli_not_include_content(content)
|
36
|
-
expect(@last_process[1]).to_not include content
|
36
|
+
expect(@last_process[1] + @last_process[2]).to_not include content
|
37
37
|
end
|
38
38
|
|
39
39
|
step(/the program output should not include "(.*?)"/,
|
data/lib/gurke/configuration.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
|
1
3
|
module Gurke
|
2
4
|
class Configuration
|
3
5
|
#
|
@@ -122,18 +124,41 @@ module Gurke
|
|
122
124
|
end
|
123
125
|
end
|
124
126
|
|
125
|
-
def run(world, &block)
|
126
|
-
|
127
|
-
@
|
127
|
+
def run(context, world, &block)
|
128
|
+
ctx = Context.new context, block
|
129
|
+
@before.each{|hook| hook.run world, ctx }
|
130
|
+
@around.reduce Context.new(context, block) do |c, e|
|
131
|
+
Context.new(context, ->{ e.run world, c })
|
132
|
+
end.call
|
128
133
|
ensure
|
129
134
|
@after.each do |hook|
|
130
135
|
begin
|
131
|
-
hook.run world
|
136
|
+
hook.run world, ctx
|
132
137
|
rescue => e
|
133
138
|
warn "Rescued error in after hook: #{e}\n#{e.backtrace.join("\n")}"
|
134
139
|
end
|
135
140
|
end
|
136
141
|
end
|
142
|
+
|
143
|
+
class Context
|
144
|
+
extend Forwardable
|
145
|
+
|
146
|
+
def initialize(context, block)
|
147
|
+
@context, @block = context, block
|
148
|
+
end
|
149
|
+
|
150
|
+
def tags
|
151
|
+
@context.tags.map(&:name)
|
152
|
+
end
|
153
|
+
|
154
|
+
def to_proc
|
155
|
+
@block
|
156
|
+
end
|
157
|
+
|
158
|
+
def call
|
159
|
+
@block.call
|
160
|
+
end
|
161
|
+
end
|
137
162
|
end
|
138
163
|
|
139
164
|
# @api private
|
@@ -149,10 +174,10 @@ module Gurke
|
|
149
174
|
!opts.any?{|k, v| context.metadata[k] != v }
|
150
175
|
end
|
151
176
|
|
152
|
-
def run(
|
177
|
+
def run(world, *args)
|
153
178
|
block = @block
|
154
|
-
if
|
155
|
-
|
179
|
+
if world
|
180
|
+
world.instance_exec(*args, &block)
|
156
181
|
else
|
157
182
|
block.call(*args)
|
158
183
|
end
|
data/lib/gurke/feature.rb
CHANGED
data/lib/gurke/feature_list.rb
CHANGED
data/lib/gurke/runner.rb
CHANGED
@@ -28,8 +28,8 @@ module Gurke
|
|
28
28
|
features.filter(options, files).run self, reporter
|
29
29
|
end
|
30
30
|
|
31
|
-
def hook(scope, world, &block)
|
32
|
-
config.hooks[scope].run world, &block
|
31
|
+
def hook(scope, world, context, &block)
|
32
|
+
config.hooks[scope].run world, context, &block
|
33
33
|
end
|
34
34
|
|
35
35
|
def with_filtered_backtrace
|
@@ -44,7 +44,7 @@ module Gurke
|
|
44
44
|
|
45
45
|
class LocalRunner < Runner
|
46
46
|
def run(*)
|
47
|
-
hook :system, nil do
|
47
|
+
hook :system, nil, nil do
|
48
48
|
super
|
49
49
|
end
|
50
50
|
end
|
@@ -56,7 +56,7 @@ module Gurke
|
|
56
56
|
def run(files)
|
57
57
|
require 'drb'
|
58
58
|
|
59
|
-
hook :system, nil do
|
59
|
+
hook :system, nil, nil do
|
60
60
|
DRb.start_service URI, self
|
61
61
|
$stdout.puts 'DRb Server running...'
|
62
62
|
|
data/lib/gurke/scenario.rb
CHANGED
data/lib/gurke/step.rb
CHANGED
@@ -22,9 +22,9 @@ module Gurke
|
|
22
22
|
|
23
23
|
return unless match
|
24
24
|
|
25
|
-
Match.new
|
25
|
+
Match.new method_name, match.to_a[1..-1]
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
Match = Struct.new :method_name, :params
|
29
29
|
end
|
30
30
|
end
|
data/lib/gurke/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gurke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- features/gurke.feature
|
82
82
|
- features/gurke.rb
|
83
83
|
- features/gurke/backtrace_filtering.feature
|
84
|
+
- features/gurke/context_in_hooks.feature
|
84
85
|
- features/gurke/filter_by_tags.feature
|
85
86
|
- features/gurke/include_by_tags.feature
|
86
87
|
- features/gurke/other_reporter.feature
|
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
139
|
version: '0'
|
139
140
|
requirements: []
|
140
141
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.4.6
|
142
143
|
signing_key:
|
143
144
|
specification_version: 4
|
144
145
|
summary: An alternative gherkin feature runner inspired by rspec and turnip.
|
@@ -146,6 +147,7 @@ test_files:
|
|
146
147
|
- features/gurke.feature
|
147
148
|
- features/gurke.rb
|
148
149
|
- features/gurke/backtrace_filtering.feature
|
150
|
+
- features/gurke/context_in_hooks.feature
|
149
151
|
- features/gurke/filter_by_tags.feature
|
150
152
|
- features/gurke/include_by_tags.feature
|
151
153
|
- features/gurke/other_reporter.feature
|