moto 1.1.4 → 1.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a363f8cb75325f915a8d93bc1ed70cf2ca463989
4
- data.tar.gz: 85fadc6408d3d036b8128f3a7ef3ec75147150d3
3
+ metadata.gz: '0955cad669b3d86d71325ab80d3d04010a485880'
4
+ data.tar.gz: f7b3aff8cfdd40bd0fbd009ded30ba332214f513
5
5
  SHA512:
6
- metadata.gz: 1f4fca1306f23d4204586ab4db764262b37573f62987aebdf46d35d4f9f402e701c1c6ca838e11b1b41bb117397dbc1cd04e6bc0e0b7d587cd1bc8e50d0a1053
7
- data.tar.gz: 7340766bd423343db618046782b5f279854799324d8bb9c29afdd9e22cca849bc2ed60098b09c16b91dd88190785c93d76d5ebf31e76b1674bf643e720b88113
6
+ metadata.gz: 061e7b129091f5caff204a38c68a64ebbfed6870e512d20634132bb8f2441eb922de07f532a2a2decd4858a47133a32ad3911b31865e6b84cee954af33acda4b
7
+ data.tar.gz: a9ed51f091931e0781f7340852c4d72c6138f52fef2f3afb2644041f1482a6ddb877ee0b3fe3643685b8f864598f465ff42849ce8458b63a05eff633b5b3391e
@@ -0,0 +1,9 @@
1
+ module Moto
2
+ module Config
3
+ # Purpose of this class is to enable developers of Moto-reliant apps to be able to monkey patch their custom methods
4
+ # to data structure (this) that holds, retrieves and modifies env config data
5
+ class Hash < Hash
6
+
7
+ end
8
+ end
9
+ end
@@ -1,8 +1,9 @@
1
1
  require 'active_support/core_ext/hash/deep_merge'
2
+ require_relative 'hash'
2
3
 
3
4
  module Moto
4
- module Lib
5
- class Config
5
+ module Config
6
+ class Manager
6
7
 
7
8
  # @return [String] String representing the name of the current environment
8
9
  def self.environment
@@ -57,14 +58,14 @@ module Moto
57
58
  end
58
59
 
59
60
  # @return [Hash] Hash representing data from MotoApp/config/moto.rb file
60
- def self.moto
61
+ def self.config_moto
61
62
  @@moto
62
63
  end
63
64
 
64
65
 
65
66
  # @return [Hash] Configuration for selected environment + current thread combination
66
- def self.environment_config
67
- Thread.current['environment_config'] ||= Marshal.load(Marshal.dump(@@env_consts))
67
+ def self.config_environment
68
+ Thread.current['config_environment'] ||= Moto::Config::Hash.new.merge!(Marshal.load(Marshal.dump(@@env_consts)))
68
69
  end
69
70
 
70
71
  end
@@ -16,7 +16,7 @@ module Moto
16
16
  tests_metadata = prepare_metadata(parsed_arguments)
17
17
  test_reporter = prepare_test_reporter(parsed_arguments)
18
18
 
19
- if Moto::Lib::Config.moto[:test_runner][:dry_run]
19
+ if Moto::Config::Manager.config_moto[:test_runner][:dry_run]
20
20
  runner = Moto::Modes::Run::DryRunner.new(tests_metadata, test_reporter)
21
21
  else
22
22
  runner = Moto::Modes::Run::TestRunner.new(tests_metadata, test_reporter, parsed_arguments[:stop_on])
@@ -11,7 +11,7 @@ module Moto
11
11
  # @param [Array] tests_metadata
12
12
  def initialize(tests_metadata)
13
13
  super()
14
- @test_repeats = Moto::Lib::Config.moto[:test_runner][:test_repeats]
14
+ @test_repeats = Moto::Config::Manager.config_moto[:test_runner][:test_repeats]
15
15
  @current_test_repeat = 1
16
16
  @queue = Queue.new
17
17
  @tests_metadata = tests_metadata
@@ -23,7 +23,7 @@ module Moto
23
23
 
24
24
  def run
25
25
  test_provider = TestProvider.new(@tests_metadata)
26
- threads_max = Moto::Lib::Config.moto[:test_runner][:thread_count] || 1
26
+ threads_max = Moto::Config::Manager.config_moto[:test_runner][:thread_count] || 1
27
27
 
28
28
  # remove log/screenshot files from previous execution
29
29
  @tests_metadata.each do |metadata|
@@ -38,7 +38,7 @@ module Moto
38
38
 
39
39
  Thread.abort_on_exception = true
40
40
 
41
- (1..threads_max).each do |index|
41
+ threads_max.times do
42
42
  Thread.new do
43
43
 
44
44
  loop do
@@ -1,5 +1,5 @@
1
1
  require 'fileutils'
2
- require_relative '../../config'
2
+ require_relative '../../config/manager'
3
3
 
4
4
  module Moto
5
5
  module Modes
@@ -72,7 +72,7 @@ module Moto
72
72
 
73
73
  # @return [Hash] Hash with config for ThreadContext
74
74
  def config
75
- Moto::Lib::Config.moto[:test_runner]
75
+ Moto::Config::Manager.config_moto[:test_runner]
76
76
  end
77
77
  private :config
78
78
 
@@ -7,7 +7,7 @@ end
7
7
 
8
8
  require 'optparse'
9
9
  require 'logger'
10
- require_relative 'config'
10
+ require_relative 'config/manager'
11
11
  require_relative 'modes/mode_selector'
12
12
 
13
13
  module Moto
@@ -20,7 +20,7 @@ module Moto
20
20
 
21
21
  # TODO: IMPORTANT ISSUE
22
22
  # xxx_parse functions should not return parsed arguments and pass them to functions
23
- # but instead all should inject proper values into Moto::Lib::Config.moto[:xxx][:yyy]
23
+ # but instead all should inject proper values into Moto::Config::Manager.config_moto[:xxx][:yyy]
24
24
  # on which all further components should relay
25
25
 
26
26
  if argv[0] == '--version'
@@ -44,24 +44,24 @@ module Moto
44
44
  end
45
45
 
46
46
  def self.prepare_config(options)
47
- Moto::Lib::Config.load_configuration(options[:config_name], options[:environment])
47
+ Moto::Config::Manager.load_configuration(options[:config_name], options[:environment])
48
48
 
49
49
  if !config_test_runner
50
- Moto::Lib::Config.moto[:test_runner] = {}
50
+ Moto::Config::Manager.config_moto[:test_runner] = {}
51
51
  end
52
52
 
53
53
  if !config_test_generator
54
- Moto::Lib::Config.moto[:test_generator] = {}
54
+ Moto::Config::Manager.config_moto[:test_generator] = {}
55
55
  end
56
56
 
57
57
  end
58
58
 
59
59
  def self.config_test_runner
60
- Moto::Lib::Config.moto[:test_runner]
60
+ Moto::Config::Manager.config_moto[:test_runner]
61
61
  end
62
62
 
63
63
  def self.config_test_generator
64
- Moto::Lib::Config.moto[:test_generator]
64
+ Moto::Config::Manager.config_moto[:test_generator]
65
65
  end
66
66
 
67
67
  def self.run_parse(argv)
@@ -104,15 +104,15 @@ module Moto
104
104
 
105
105
  # Runner configuration
106
106
 
107
- Moto::Lib::Config.moto[:test_runner][:thread_count] = options[:threads] if options[:threads]
108
- Moto::Lib::Config.moto[:test_runner][:test_attempt_max] = options[:attempts] if options[:attempts]
109
- Moto::Lib::Config.moto[:test_runner][:dry_run] = options[:dry_run] if options[:dry_run]
110
- Moto::Lib::Config.moto[:test_runner][:explicit_errors] = options[:explicit_errors] if options[:explicit_errors]
107
+ Moto::Config::Manager.config_moto[:test_runner][:thread_count] = options[:threads] if options[:threads]
108
+ Moto::Config::Manager.config_moto[:test_runner][:test_attempt_max] = options[:attempts] if options[:attempts]
109
+ Moto::Config::Manager.config_moto[:test_runner][:dry_run] = options[:dry_run] if options[:dry_run]
110
+ Moto::Config::Manager.config_moto[:test_runner][:explicit_errors] = options[:explicit_errors] if options[:explicit_errors]
111
111
 
112
112
  # Test log level parsing
113
113
 
114
114
  if options[:log_level]
115
- Moto::Lib::Config.moto[:test_runner][:log_level] = case options[:log_level].downcase
115
+ Moto::Config::Manager.config_moto[:test_runner][:log_level] = case options[:log_level].downcase
116
116
  when 'info' then Logger::INFO
117
117
  when 'warn' then Logger::WARN
118
118
  when 'error' then Logger::ERROR
@@ -120,11 +120,11 @@ module Moto
120
120
  else Logger::DEBUG
121
121
  end
122
122
  else
123
- Moto::Lib::Config.moto[:test_runner][:log_level] = Logger::DEBUG
123
+ Moto::Config::Manager.config_moto[:test_runner][:log_level] = Logger::DEBUG
124
124
  end
125
125
 
126
126
  # Generator configuration
127
- Moto::Lib::Config.moto[:test_generator][:param_name] = options[:param_name] if options[:param_name]
127
+ Moto::Config::Manager.config_moto[:test_generator][:param_name] = options[:param_name] if options[:param_name]
128
128
 
129
129
  return options
130
130
  end
@@ -7,7 +7,7 @@ module Moto
7
7
 
8
8
  def end_run(run_status)
9
9
 
10
- path = Moto::Lib::Config.moto[:test_reporter][:listeners][:junit_xml][:output_file]
10
+ path = Moto::Config::Manager.config_moto[:test_reporter][:listeners][:junit_xml][:output_file]
11
11
 
12
12
  run_status_hash = {
13
13
  errors: run_status.tests_error.length,
@@ -138,7 +138,7 @@ module Moto
138
138
 
139
139
  # @return [Hash] Hash with config for WebUI
140
140
  def config
141
- Moto::Lib::Config.moto[:test_reporter][:listeners][:webui]
141
+ Moto::Config::Manager.config_moto[:test_reporter][:listeners][:webui]
142
142
  end
143
143
  private :config
144
144
 
@@ -90,7 +90,7 @@ module Moto
90
90
 
91
91
  # @return [Hash] Hash with config for TestReporter
92
92
  def config
93
- Moto::Lib::Config.moto[:test_reporter]
93
+ Moto::Config::Manager.config_moto[:test_reporter]
94
94
  end
95
95
  private :config
96
96
 
data/lib/test/base.rb CHANGED
@@ -163,7 +163,7 @@ module Moto
163
163
 
164
164
  # @return [Hash] Configuration for selected environment + current thread combination
165
165
  def env
166
- Moto::Lib::Config.environment_config
166
+ Moto::Config::Manager.config_environment
167
167
  end
168
168
 
169
169
  # @return [Logger]
@@ -122,7 +122,7 @@ module Moto
122
122
 
123
123
  # @return [Hash] Hash with config for test generator
124
124
  def config
125
- Moto::Lib::Config.moto[:test_generator]
125
+ Moto::Config::Manager.config_moto[:test_generator]
126
126
  end
127
127
  private :config
128
128
 
@@ -4,7 +4,7 @@ end
4
4
 
5
5
  require_relative 'metadata'
6
6
  require_relative '../version'
7
- require_relative '../config'
7
+ require_relative '../config/manager'
8
8
 
9
9
  module Moto
10
10
  module Test
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Moto
2
- VERSION = '1.1.4'
2
+ VERSION = '1.1.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartek Wilczek
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-02-12 00:00:00.000000000 Z
14
+ date: 2018-02-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -68,7 +68,8 @@ extensions: []
68
68
  extra_rdoc_files: []
69
69
  files:
70
70
  - bin/moto
71
- - lib/config.rb
71
+ - lib/config/hash.rb
72
+ - lib/config/manager.rb
72
73
  - lib/exceptions/base.rb
73
74
  - lib/exceptions/test_forced_failure.rb
74
75
  - lib/exceptions/test_forced_passed.rb