lopata 0.1.7 → 0.1.12

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
  SHA256:
3
- metadata.gz: 7f4b4814d88cd3b9da3a34159e3c1c977d05cbb0504d3dc0b2ab8034044dfbf0
4
- data.tar.gz: 378e5a3c346c64cb4430577dcfab31cfefd54a2c8e8ee30046609cf10e1bdba4
3
+ metadata.gz: 65f89b815ebe8514f78c803eab2bd2ece867e9fcdc9c28c178a721d717fd0341
4
+ data.tar.gz: c418371982133703b0b97921fd870937052854e6975b4bb47f664105c56ed6b6
5
5
  SHA512:
6
- metadata.gz: ff0498d9c9b665d52f5a8d1e65cdc6dc9078f0df1cd4f7fd831393af04ee564a5cf9a9f55305bd4423ff92062cdb7fd4a728bb2be657f196f91447faddffa941
7
- data.tar.gz: 063a3914c5e5dd088ad56e37ea527c540e8dc82f0d56e7dca4564e61699541000e4d801a80898b2d89eb6719cfd4d1a887d3884a52335f0e6339ffc9a91569fb
6
+ metadata.gz: d54572c90bfdaea0aa91747541016d0d0b1ac1710a9d9a54c8278861643a07f5a8ea7157206a85cbaf3f3986c0dbabd14bfa741a5ce7eb7deb6bd2917d2d6b89
7
+ data.tar.gz: 3d82e45bd0fd6c2901c65a4a07437a27df8b8367e1682a67b191f4829bb6bf2a11b583f319804e560e08774f806c675d82547bdb87fec623a1d6fb143d9d2b72
data/exe/lopata CHANGED
@@ -4,7 +4,7 @@ require 'lopata/runner'
4
4
 
5
5
  # use default command with arguments if given command is unknown.
6
6
  argv = ARGV.dup
7
- unless Lopata::Runner.all_commands.keys.include? argv
7
+ unless Lopata::Runner.all_commands.keys.map(&:to_s).include? argv.first
8
8
  argv.unshift 'test'
9
9
  end
10
10
 
@@ -20,6 +20,8 @@ module Lopata
20
20
  condition.keys.all? { |k| metadata[k] == condition[k] }
21
21
  when Array
22
22
  condition.map { |key| metadata[key] }.all?
23
+ when TrueClass, FalseClass
24
+ condition
23
25
  else
24
26
  metadata[condition]
25
27
  end
@@ -1,4 +1,5 @@
1
1
  require_relative 'backtrace_formatter'
2
+ require 'forwardable'
2
3
 
3
4
  module Lopata
4
5
  module Observers
@@ -45,6 +45,24 @@ module Lopata
45
45
  def as(*args, &block)
46
46
  @roles = args.flatten
47
47
  @roles << Lopata::ScenarioBuilder::CalculatedValue.new(&block) if block_given?
48
+ @use_all_roles = true
49
+ @role_options = nil
50
+ end
51
+
52
+ # Enumerate the roles the scenario can be run.
53
+ #
54
+ # The scenario should be set to use the role via before_scenario step using #current_role param.
55
+ #
56
+ # Only first role will be used if scenario has no options or diagonales. Some first roles will be used if
57
+ # options or diagonales are declared, in order of appearence.
58
+ #
59
+ # Use this to describe possible roles, but not needed to run scenario with all of them in order to save time
60
+ # of running.
61
+ #
62
+ # @param args [Array<Symbol>] list of roles the scenario to be runned with.
63
+ def as_first(*args, &block)
64
+ @roles = args.flatten
65
+ @use_all_roles = false
48
66
  @role_options = nil
49
67
  end
50
68
 
@@ -69,7 +87,8 @@ module Lopata
69
87
  # @private
70
88
  def build_role_options
71
89
  return [] unless roles
72
- [Lopata::ScenarioBuilder::Diagonal.new(:as, roles.map { |r| [Lopata.configuration.role_descriptions[r], r] })]
90
+ role_variants = roles.map { |r| [Lopata.configuration.role_descriptions[r], r] }
91
+ [Lopata::ScenarioBuilder::Diagonal.new(:as, role_variants, @use_all_roles)]
73
92
  end
74
93
 
75
94
  # @private
@@ -448,8 +448,8 @@ class Lopata::ScenarioBuilder
448
448
 
449
449
  # @private
450
450
  class Option
451
- attr_reader :variants, :key
452
- def initialize(key, variants)
451
+ attr_reader :variants, :key, :use_all_variants
452
+ def initialize(key, variants, use_all_variants = true)
453
453
  @key = key
454
454
  @variants =
455
455
  if variants.is_a? Hash
@@ -458,6 +458,7 @@ class Lopata::ScenarioBuilder
458
458
  # Array of arrays of two elements
459
459
  variants.map { |v| Variant.new(self, key, *v) }
460
460
  end
461
+ @use_all_variants = use_all_variants
461
462
  end
462
463
 
463
464
  # Variants to apply at one level
@@ -469,6 +470,7 @@ class Lopata::ScenarioBuilder
469
470
  @current ||= 0
470
471
  selected_variant = variants[@current]
471
472
  @current += 1
473
+ @complete = true unless use_all_variants # not need to verify all variants, just use first ones.
472
474
  if @current >= variants.length
473
475
  @current = 0
474
476
  @complete = true # all variants have been selected
@@ -1,3 +1,5 @@
1
+ require 'forwardable'
2
+
1
3
  module Lopata
2
4
  # @private
3
5
  class Step
@@ -1,6 +1,6 @@
1
1
  module Lopata
2
2
  # @private
3
3
  module Version
4
- STRING = '0.1.7'
4
+ STRING = '0.1.12'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lopata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Volochnev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-02 00:00:00.000000000 Z
11
+ date: 2021-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.11.0
19
+ version: 0.18.1
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.11.0
26
+ version: 0.18.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thor
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -138,5 +138,5 @@ requirements: []
138
138
  rubygems_version: 3.0.3
139
139
  signing_key:
140
140
  specification_version: 4
141
- summary: lopata-0.1.7
141
+ summary: lopata-0.1.12
142
142
  test_files: []