Module: OpenapiFirst::Test::Methods
- Defined in:
- lib/openapi_first/test/methods.rb
Overview
Methods to use in integration tests
Defined Under Namespace
Modules: DefaultApiMethod
Class Method Summary collapse
- .[](application_under_test = nil, api: nil, validate_request_before_handling: false) ⇒ Object
- .included(base) ⇒ Object
Class Method Details
.[](application_under_test = nil, api: nil, validate_request_before_handling: false) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/openapi_first/test/methods.rb', line 15 def self.[](application_under_test = nil, api: nil, validate_request_before_handling: false) mod = Module.new do def self.included(base) base.include OpenapiFirst::Test::Methods::AssertionMethod end end mod.define_method(:openapi_first_validate_request_before_handling?) { validate_request_before_handling } if api mod.define_method(:openapi_first_default_api) { api } else mod.include(DefaultApiMethod) end if application_under_test mod.define_method(:app) do OpenapiFirst::Test.app( application_under_test, api: openapi_first_default_api, validate_request_before_handling: openapi_first_validate_request_before_handling? ) end end mod end |
.included(base) ⇒ Object
10 11 12 13 |
# File 'lib/openapi_first/test/methods.rb', line 10 def self.included(base) base.include(DefaultApiMethod) base.include(AssertionMethod) end |