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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dff85ce0c564b05532a1515160b8bd9fde071699
4
- data.tar.gz: c9581f3c290bdfc0360928f9e8fd7ddb19a42351
3
+ metadata.gz: 712047197c8132ea6944a4b7d4e0a763c466cfb7
4
+ data.tar.gz: 9349d3865b94a4ffe5c271436fdc3b76bf5045e0
5
5
  SHA512:
6
- metadata.gz: 373a68b8f9029b4c8a5b1e58503732ca45f7f1b6076b9260b8df7f01d84c8a068c1c82131739715b2cc38cfaf347d6f98498f7b2bf71a3521cffbf4273a8a411
7
- data.tar.gz: 686f35af91c02ce7693e6f8ceb63135bf72abd982f8026e835c032e2f11ef98fd0137dc15d242bd5e9bdb55143f81028bd69460abebd40a6c88d0f7213f635c8
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
- puts "Parameters error:\n\t File: #{params_path}\n\t Error: #{e.message}\n\n"
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
- class << test_object
108
- attr_accessor :custom_name
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
@@ -1,3 +1,3 @@
1
1
  module Moto
2
- VERSION = '0.0.43'
2
+ VERSION = '0.0.44'
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: 0.0.43
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-25 00:00:00.000000000 Z
14
+ date: 2016-04-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport