Class: Kumi::Dev::Golden::RuntimeTest
- Inherits:
-
Object
- Object
- Kumi::Dev::Golden::RuntimeTest
- Defined in:
- lib/kumi/dev/golden/runtime_test.rb
Instance Attribute Summary collapse
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#schema_name ⇒ Object
readonly
Returns the value of attribute schema_name.
Instance Method Summary collapse
-
#initialize(schema_name, language) ⇒ RuntimeTest
constructor
A new instance of RuntimeTest.
- #run(base_dir) ⇒ Object
Constructor Details
#initialize(schema_name, language) ⇒ RuntimeTest
Returns a new instance of RuntimeTest.
14 15 16 17 |
# File 'lib/kumi/dev/golden/runtime_test.rb', line 14 def initialize(schema_name, language) @schema_name = schema_name @language = language end |
Instance Attribute Details
#language ⇒ Object (readonly)
Returns the value of attribute language.
12 13 14 |
# File 'lib/kumi/dev/golden/runtime_test.rb', line 12 def language @language end |
#schema_name ⇒ Object (readonly)
Returns the value of attribute schema_name.
12 13 14 |
# File 'lib/kumi/dev/golden/runtime_test.rb', line 12 def schema_name @schema_name end |
Instance Method Details
#run(base_dir) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/kumi/dev/golden/runtime_test.rb', line 19 def run(base_dir) # Skip JavaScript runtime tests for schemas with imports (requires generated shared modules) if language == :javascript && has_imports?(base_dir) return SchemaTestResult.new( schema_name: schema_name, skipped: true, skip_reason: "JavaScript runtime testing for schemas with imports requires generated shared modules" ) end expected_outputs = load_expected_outputs(base_dir) actual_outputs = execute_schema(base_dir, expected_outputs.keys) test_results = expected_outputs.map do |decl_name, expected_value| RuntimeTestResult.new( schema_name: schema_name, decl_name: decl_name, expected: expected_value, actual: actual_outputs[decl_name], language: language ) end SchemaTestResult.new( schema_name: schema_name, test_results: test_results ) rescue StandardError => e SchemaTestResult.new( schema_name: schema_name, error: e. ) end |