moto 0.0.43 → 0.0.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/runner/test_generator.rb +30 -12
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 712047197c8132ea6944a4b7d4e0a763c466cfb7
|
4
|
+
data.tar.gz: 9349d3865b94a4ffe5c271436fdc3b76bf5045e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e8260a7dc2c7d7836bb31270f80273aad5023952f8f301a1a9cb7969f8bf712f5b18ebd402a27ad92c305cebbc6d7bd1a055ea0b135050ed0584b2dfa4ec2f
|
7
|
+
data.tar.gz: e834cbc0b9c689e9e71bc6d82f3c52db2a53e4a72fe109c0629f3169048875721bcf6740e1b227a5c9cd8ba914b767bf27fd1c0e7360861d83e5f6eed4493195
|
@@ -41,7 +41,9 @@ module Moto
|
|
41
41
|
begin
|
42
42
|
params_all = eval(File.read(params_path))
|
43
43
|
rescue Exception => e
|
44
|
-
|
44
|
+
# Error will be injected into test.run after test is created
|
45
|
+
params_error = e.message
|
46
|
+
params_all = [{}]
|
45
47
|
end
|
46
48
|
else
|
47
49
|
params_all = [{}]
|
@@ -59,8 +61,18 @@ module Moto
|
|
59
61
|
test.init(env, params, params_index, @internal_counter)
|
60
62
|
test.log_path = "#{test.dir}/logs/#{test.name.gsub(/[^0-9A-Za-z.\-]/, '_')}.log"
|
61
63
|
@internal_counter += 1
|
64
|
+
|
65
|
+
# Error handling, test.run() contents will be swapped with raised exception
|
66
|
+
# so there is an indication in reporters/logs that something went wrong
|
67
|
+
if params_error
|
68
|
+
error_message = "ERROR: Invalid parameters file: #{test.dir}.\n\tMESSAGE: #{params_error}"
|
69
|
+
inject_error_to_test(test, error_message)
|
70
|
+
end
|
71
|
+
|
62
72
|
variants << test
|
63
73
|
end
|
74
|
+
|
75
|
+
|
64
76
|
end
|
65
77
|
|
66
78
|
variants
|
@@ -92,8 +104,6 @@ module Moto
|
|
92
104
|
# no need to handle it here, next begin/rescue clause in this function will finish the job
|
93
105
|
end
|
94
106
|
|
95
|
-
test_object = nil
|
96
|
-
|
97
107
|
# Checking if it's possible to create test based on provided path. In case something is wrong with
|
98
108
|
# modules structure in class itself Moto::Test::Base will be instantized with raise injected into its run()
|
99
109
|
# so we can have proper reporting and summary even if the test doesn't execute.
|
@@ -104,15 +114,8 @@ module Moto
|
|
104
114
|
class_name = Moto::Test::Base
|
105
115
|
test_object = class_name.new
|
106
116
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
def run
|
111
|
-
raise "ERROR: Invalid module structure: #{custom_name}"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
test_object.custom_name = test_path_absolute.gsub("#{MotoApp::DIR}/", 'moto_app/').camelize.chomp('.rb')
|
117
|
+
error_message = "ERROR: Invalid module structure: #{test_path_absolute.gsub("#{MotoApp::DIR}/", 'moto_app/').camelize.chomp('.rb')}"
|
118
|
+
inject_error_to_test(test_object, error_message)
|
116
119
|
end
|
117
120
|
|
118
121
|
test_object.static_path = test_path_absolute
|
@@ -166,6 +169,21 @@ module Moto
|
|
166
169
|
end
|
167
170
|
private :generate_for_run_body
|
168
171
|
|
172
|
+
# Injects raise into test.run so it will report an error when executed
|
173
|
+
# @param [Moto::Test::Base] test An instance of test that is supposed to be modified
|
174
|
+
# @param [String] error_message Message to be attached to the raised exception
|
175
|
+
def inject_error_to_test(test, error_message)
|
176
|
+
class << test
|
177
|
+
attr_accessor :injected_error_message
|
178
|
+
|
179
|
+
def run
|
180
|
+
raise injected_error_message
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
test.injected_error_message = error_message
|
185
|
+
end
|
186
|
+
|
169
187
|
end
|
170
188
|
end
|
171
189
|
end
|
data/lib/version.rb
CHANGED
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: 0.0.
|
4
|
+
version: 0.0.44
|
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: 2016-04-
|
14
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|