Class: Skooma::Matchers::Wrapper
- Inherits:
-
Module
- Object
- Module
- Skooma::Matchers::Wrapper
- Defined in:
- lib/skooma/matchers/wrapper.rb
Direct Known Subclasses
Defined Under Namespace
Modules: DefaultHelperMethods
Constant Summary collapse
- TEST_REGISTRY_NAME =
"skooma_test_registry"
Instance Attribute Summary collapse
-
#coverage ⇒ Object
Returns the value of attribute coverage.
-
#schema ⇒ Object
Returns the value of attribute schema.
Instance Method Summary collapse
-
#initialize(helper_methods_module, openapi_path, base_uri: "https://skoomarb.dev/", path_prefix: "", enforce_access_modes: false, use_patterns_for_path_matching: false, coverage_store: nil, **params) ⇒ Wrapper
constructor
A new instance of Wrapper.
Constructor Details
#initialize(helper_methods_module, openapi_path, base_uri: "https://skoomarb.dev/", path_prefix: "", enforce_access_modes: false, use_patterns_for_path_matching: false, coverage_store: nil, **params) ⇒ Wrapper
Returns a new instance of Wrapper.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/skooma/matchers/wrapper.rb', line 48 def initialize(helper_methods_module, openapi_path, base_uri: "https://skoomarb.dev/", path_prefix: "", enforce_access_modes: false, use_patterns_for_path_matching: false, coverage_store: nil, **params) super() registry = create_test_registry pathname = Pathname.new(openapi_path) source_uri = "#{base_uri}#{path_prefix.delete_suffix("/").delete_prefix("/")}" source_uri += "/" unless source_uri.end_with?("/") registry.add_source( source_uri, JSONSkooma::Sources::Local.new(pathname.dirname.to_s) ) @schema = registry.schema(URI.parse("#{source_uri}#{pathname.basename}"), schema_class: Skooma::Objects::OpenAPI) @schema.path_prefix = path_prefix @schema.enforce_access_modes = enforce_access_modes # Any object implementing CoverageStore's interface (load_data, # save_data, clear) can be passed via `coverage_store:` — e.g. to # write one file per parallel CI runner and merge afterwards. storage = coverage_store || Skooma::CoverageStore.new( file_path: File.join(Dir.pwd, "tmp", "skooma_coverage_#{Digest::SHA256.hexdigest(source_uri)[0..8]}.json") ) @coverage = Coverage.new(@schema, mode: params[:coverage], format: params[:coverage_format], storage: storage) @schema.use_patterns_for_path_matching = use_patterns_for_path_matching include DefaultHelperMethods include helper_methods_module skooma_self = self define_method :skooma do skooma_self end end |
Instance Attribute Details
#coverage ⇒ Object
Returns the value of attribute coverage.
82 83 84 |
# File 'lib/skooma/matchers/wrapper.rb', line 82 def coverage @coverage end |
#schema ⇒ Object
Returns the value of attribute schema.
82 83 84 |
# File 'lib/skooma/matchers/wrapper.rb', line 82 def schema @schema end |