lopata 0.1.35 → 0.1.37
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/lib/lopata/condition.rb +31 -1
- data/lib/lopata/scenario.rb +2 -1
- data/lib/lopata/step.rb +10 -2
- data/lib/lopata/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 26144921e2b69dc4a941e05583c6fab3fc5f0e85a9f19e3b0f76b4762c560c09
|
|
4
|
+
data.tar.gz: dcdb2f5e7507d897030f8977c1d58100ceeb53d7ac6dff8c6a9af7af8e5c23b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f54ef97186d06cf3486e053adc5118007f1926694441aa5741fae31f0de42947ce2cc340c0be1839ffdc12d5ecf7b7961f861f43a27067aad59fefc933be597c
|
|
7
|
+
data.tar.gz: 1e93d0d56949000c9bd621b6f033d3645bf3371540f7ed5b215c590641a1b86caf166b1f7679b89d6810d7c7307a78eb44075bd78a9427627300234c5f821f9a
|
data/lib/lopata/condition.rb
CHANGED
|
@@ -10,6 +10,13 @@ module Lopata
|
|
|
10
10
|
alias positive? positive
|
|
11
11
|
alias dynamic? dynamic
|
|
12
12
|
|
|
13
|
+
# Combine conditions: the result matches when all the given conditions match.
|
|
14
|
+
def self.combine(*conditions)
|
|
15
|
+
conditions = conditions.compact
|
|
16
|
+
return conditions.first if conditions.length <= 1
|
|
17
|
+
CombinedCondition.new(conditions)
|
|
18
|
+
end
|
|
19
|
+
|
|
13
20
|
# Match scenario on build-time.
|
|
14
21
|
def match?(scenario)
|
|
15
22
|
# dynamic steps match scenario in build-time: will be verified later
|
|
@@ -44,4 +51,27 @@ module Lopata
|
|
|
44
51
|
positive? ? matched : !matched
|
|
45
52
|
end
|
|
46
53
|
end
|
|
47
|
-
|
|
54
|
+
|
|
55
|
+
# @private
|
|
56
|
+
# All the conditions must match.
|
|
57
|
+
class CombinedCondition
|
|
58
|
+
attr_reader :conditions, :dynamic
|
|
59
|
+
|
|
60
|
+
def initialize(conditions)
|
|
61
|
+
@conditions = conditions
|
|
62
|
+
@dynamic = conditions.any?(&:dynamic?)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
alias dynamic? dynamic
|
|
66
|
+
|
|
67
|
+
def match?(scenario)
|
|
68
|
+
conditions.all? { |c| c.match?(scenario) }
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def match_dynamic?(scenario_runtime)
|
|
72
|
+
return false unless dynamic?
|
|
73
|
+
# Static conditions are verified on build-time, so check dynamic ones only.
|
|
74
|
+
conditions.select(&:dynamic?).all? { |c| c.match_dynamic?(scenario_runtime) }
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
data/lib/lopata/scenario.rb
CHANGED
|
@@ -63,7 +63,7 @@ class Lopata::Scenario
|
|
|
63
63
|
# @private
|
|
64
64
|
# Scenario execution and live-cycle information
|
|
65
65
|
class Execution
|
|
66
|
-
attr_reader :scenario, :current_step, :top, :title, :base_metadata
|
|
66
|
+
attr_reader :scenario, :current_step, :top, :title, :base_metadata, :started_at
|
|
67
67
|
|
|
68
68
|
def initialize(title, metadata = {})
|
|
69
69
|
@title = title
|
|
@@ -87,6 +87,7 @@ class Lopata::Scenario
|
|
|
87
87
|
setup
|
|
88
88
|
top.reset_status
|
|
89
89
|
end
|
|
90
|
+
@started_at = Time.now
|
|
90
91
|
world.notify_observers(:scenario_started, self)
|
|
91
92
|
run_step(top)
|
|
92
93
|
world.notify_observers(:scenario_finished, self)
|
data/lib/lopata/step.rb
CHANGED
|
@@ -40,7 +40,10 @@ module Lopata
|
|
|
40
40
|
if step.is_a?(String)
|
|
41
41
|
Lopata::SharedStep.find(step).steps.each do |shared_step|
|
|
42
42
|
next if shared_step.condition && !shared_step.condition.match?(scenario)
|
|
43
|
-
|
|
43
|
+
shared_executions = shared_step.execution_steps(scenario, parent: parent)
|
|
44
|
+
# Static conditions are already applied on build-time, dynamic ones must be checked on runtime.
|
|
45
|
+
shared_executions.each { |e| e.add_condition(condition) } if condition&.dynamic?
|
|
46
|
+
steps += shared_executions
|
|
44
47
|
end
|
|
45
48
|
elsif step.is_a?(Proc)
|
|
46
49
|
steps << StepExecution.new(self, parent, condition: condition, &step)
|
|
@@ -173,7 +176,12 @@ module Lopata
|
|
|
173
176
|
end
|
|
174
177
|
|
|
175
178
|
def ignored!
|
|
176
|
-
status
|
|
179
|
+
@status = :ignored
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Add condition to be matched in addition to own step condition.
|
|
183
|
+
def add_condition(other)
|
|
184
|
+
@condition = Lopata::Condition.combine(other, @condition)
|
|
177
185
|
end
|
|
178
186
|
|
|
179
187
|
def skip!
|
data/lib/lopata/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lopata
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.37
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexey Volochnev
|
|
@@ -135,5 +135,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
135
135
|
requirements: []
|
|
136
136
|
rubygems_version: 3.6.8
|
|
137
137
|
specification_version: 4
|
|
138
|
-
summary: lopata-0.1.
|
|
138
|
+
summary: lopata-0.1.37
|
|
139
139
|
test_files: []
|