Class: OpenapiFirst::Test::Configuration
- Inherits:
-
Object
- Object
- OpenapiFirst::Test::Configuration
- Defined in:
- lib/openapi_first/test/configuration.rb
Overview
Helper class to setup tests
Instance Attribute Summary collapse
-
#apps ⇒ Object
readonly
Returns the value of attribute apps.
-
#coverage_formatter ⇒ Object
Returns the value of attribute coverage_formatter.
-
#coverage_formatter_options ⇒ Object
Returns the value of attribute coverage_formatter_options.
-
#ignore_unknown_requests ⇒ Object
Returns the value of attribute ignore_unknown_requests.
-
#ignored_unknown_status ⇒ Object
readonly
Returns the value of attribute ignored_unknown_status.
-
#minimum_coverage ⇒ Object
Returns the value of attribute minimum_coverage.
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
-
#report_coverage ⇒ Object
Returns the value of attribute report_coverage.
-
#response_raise_error ⇒ Object
Returns the value of attribute response_raise_error.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#observe(app, api: :default) ⇒ Object
Observe a rack app.
-
#register(oad, as: :default) ⇒ Object
Register OADs, but don’t load them just yet.
- #skip_response_coverage(&block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/openapi_first/test/configuration.rb', line 7 def initialize @minimum_coverage = 100 @coverage_formatter = Coverage::TerminalFormatter @coverage_formatter_options = {} @skip_response_coverage = nil @response_raise_error = true @ignored_unknown_status = [404] @report_coverage = true @ignore_unknown_requests = false @registry = {} @apps = {} end |
Instance Attribute Details
#apps ⇒ Object (readonly)
Returns the value of attribute apps.
34 35 36 |
# File 'lib/openapi_first/test/configuration.rb', line 34 def apps @apps end |
#coverage_formatter ⇒ Object
Returns the value of attribute coverage_formatter.
32 33 34 |
# File 'lib/openapi_first/test/configuration.rb', line 32 def coverage_formatter @coverage_formatter end |
#coverage_formatter_options ⇒ Object
Returns the value of attribute coverage_formatter_options.
32 33 34 |
# File 'lib/openapi_first/test/configuration.rb', line 32 def @coverage_formatter_options end |
#ignore_unknown_requests ⇒ Object
Returns the value of attribute ignore_unknown_requests.
32 33 34 |
# File 'lib/openapi_first/test/configuration.rb', line 32 def ignore_unknown_requests @ignore_unknown_requests end |
#ignored_unknown_status ⇒ Object (readonly)
Returns the value of attribute ignored_unknown_status.
34 35 36 |
# File 'lib/openapi_first/test/configuration.rb', line 34 def ignored_unknown_status @ignored_unknown_status end |
#minimum_coverage ⇒ Object
Returns the value of attribute minimum_coverage.
32 33 34 |
# File 'lib/openapi_first/test/configuration.rb', line 32 def minimum_coverage @minimum_coverage end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
34 35 36 |
# File 'lib/openapi_first/test/configuration.rb', line 34 def registry @registry end |
#report_coverage ⇒ Object
Returns the value of attribute report_coverage.
34 35 36 |
# File 'lib/openapi_first/test/configuration.rb', line 34 def report_coverage @report_coverage end |
#response_raise_error ⇒ Object
Returns the value of attribute response_raise_error.
32 33 34 |
# File 'lib/openapi_first/test/configuration.rb', line 32 def response_raise_error @response_raise_error end |
Instance Method Details
#observe(app, api: :default) ⇒ Object
Observe a rack app
28 29 30 |
# File 'lib/openapi_first/test/configuration.rb', line 28 def observe(app, api: :default) @apps[api] = app end |
#register(oad, as: :default) ⇒ Object
Register OADs, but don’t load them just yet
23 24 25 |
# File 'lib/openapi_first/test/configuration.rb', line 23 def register(oad, as: :default) @registry[as] = oad end |
#skip_response_coverage(&block) ⇒ Object
47 48 49 50 51 |
# File 'lib/openapi_first/test/configuration.rb', line 47 def skip_response_coverage(&block) return @skip_response_coverage unless block_given? @skip_response_coverage = block end |