moto 1.0.12 → 1.0.13

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
  SHA1:
3
- metadata.gz: 39f52f8dccdb00eac3991c483030debf6aa9f025
4
- data.tar.gz: cb1036e945d4e20785f2ba5663a14a499ab03075
3
+ metadata.gz: f4b0da411925819e71869d6cec3b81471ac4cdd3
4
+ data.tar.gz: 1a678c0f42a28cc37e01b41a4a4419c9290985f0
5
5
  SHA512:
6
- metadata.gz: e02c742053a59067709a674518f8a9952d31dc089e7f82e60e2f9502055e3697b4c5c16293e25a014a838b8f144373cf6d12ad5eecf2b5e0d54f8d79b3187f89
7
- data.tar.gz: bd7a4b7f81656b77e2a37020cdc2bc1275eef12d3571de59b5cd8caf37f5e302529c046fb9b655f7fbc1fcfda35e04c7ddadc85ae6bd7d7a22698bcf4af9ed0f
6
+ metadata.gz: dab17cc2b292dbabda911d5d989573c32749d8e9930cdf10d6c119b704807a10bc4c029509bfea88d6d95e096055321b2438cc09ba3ce9b944f02d793f1a2e72
7
+ data.tar.gz: a7fc7db8a00321daf7ba728c7bf1ee232b66d4a186ae86dfffadaa1193496717d5f2f9f64f0c93df75a5950e5bbb312c6708780abd5740fb8a637df7174ee6c3
data/lib/config.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'active_support'
1
+ require 'active_support/core_ext/hash/deep_merge'
2
2
 
3
3
  module Moto
4
4
  module Lib
@@ -61,26 +61,10 @@ module Moto
61
61
  @@moto
62
62
  end
63
63
 
64
- #
65
- # @param [String] key Name of the key which's value is to be retrieved
66
- # @return [String] Value of the key
67
- def self.environment_const(key)
68
- key = key.to_s
69
64
 
70
- code = if key.include? '.'
71
- "@@env_consts#{key.split('.').map { |a| "[:#{a}]" }.join('')}"
72
- else
73
- "@@env_consts[:#{key}]"
74
- end
75
-
76
- begin
77
- value = eval(code)
78
- raise if value.nil?
79
- rescue
80
- raise "There is no const defined for key: #{key}."
81
- end
82
-
83
- Marshal.load(Marshal.dump(value))
65
+ # @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))
84
68
  end
85
69
 
86
70
  end
@@ -40,16 +40,22 @@ module Moto
40
40
 
41
41
  (1..threads_max).each do |index|
42
42
  Thread.new do
43
- Thread.current[:id] = index
43
+
44
44
  loop do
45
45
  tc = ThreadContext.new(test_provider.get_test, @test_reporter)
46
46
  tc.run
47
+
48
+ # unset all leftover variables stored 'globally' in Thread
49
+ Thread.current.keys.each do |k|
50
+ Thread.current[k] = nil
51
+ end
52
+
47
53
  end
48
54
  end
49
55
  end
50
56
 
51
57
  # Waiting for all threads to run out of work so we can end the application
52
- # or abonormal termination to be triggered based on options provided by the user
58
+ # or abnormal termination to be triggered based on options provided by the user
53
59
  loop do
54
60
  run_status = @test_reporter.run_status
55
61
  if (test_provider.num_waiting == threads_max) ||
@@ -1,5 +1,4 @@
1
1
  require 'rest-client'
2
- require 'sys/uname'
3
2
  require 'uri'
4
3
 
5
4
  module Moto
data/lib/test/base.rb CHANGED
@@ -6,7 +6,6 @@ module Moto
6
6
  class Base
7
7
 
8
8
  attr_reader :name
9
- attr_reader :env
10
9
  attr_reader :params
11
10
  attr_accessor :static_path
12
11
  attr_accessor :status
@@ -120,22 +119,6 @@ module Moto
120
119
  raise Exceptions::TestForcedPassed.new msg
121
120
  end
122
121
 
123
-
124
- # Checks for equality of both arguments
125
- def assert_equal(a, b)
126
- assert(a == b, "Arguments should be equal: #{a} != #{b}.")
127
- end
128
-
129
- # Checks if passed value is equal to True
130
- def assert_true(value)
131
- assert(value, 'Logical condition not met, expecting true, given false.')
132
- end
133
-
134
- # Checks if passed value is equal to False
135
- def assert_false(value)
136
- assert(!value, 'Logical condition not met, expecting false, given true.')
137
- end
138
-
139
122
  # Checks if result of condition equals to True
140
123
  def assert(condition, message)
141
124
  if !condition
@@ -143,14 +126,13 @@ module Moto
143
126
 
144
127
  status.log_failure("ASSERTION FAILED in line #{line_number}: #{message}")
145
128
  logger.error(message)
129
+ env
146
130
  end
147
131
  end
148
132
 
149
- # Read a constants value from configuration files while taking the execution environment into the account.
150
- # @param [String] key Key to be searched for.
151
- # @return [String] Value of the key or nil if not found
152
- def const(key)
153
- Moto::Lib::Config.environment_const(key)
133
+ # @return [Hash] Configuration for selected environment + current thread combination
134
+ def env
135
+ Moto::Lib::Config.environment_config
154
136
  end
155
137
 
156
138
  # @return [Logger]
@@ -1,7 +1,3 @@
1
- require 'logger'
2
- require 'pp'
3
- require 'yaml'
4
-
5
1
  module MotoApp
6
2
  DIR = Dir.pwd
7
3
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Moto
2
- VERSION = '1.0.12'
2
+ VERSION = '1.0.13'
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.0.12
4
+ version: 1.0.13
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-06 00:00:00.000000000 Z
14
+ date: 2018-02-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport