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_coverage(&block) ⇒ Object
- #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 19 |
# 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 @skip_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.
35 36 37 |
# File 'lib/openapi_first/test/configuration.rb', line 35 def apps @apps end |
#coverage_formatter ⇒ Object
Returns the value of attribute coverage_formatter.
33 34 35 |
# File 'lib/openapi_first/test/configuration.rb', line 33 def coverage_formatter @coverage_formatter end |
#coverage_formatter_options ⇒ Object
Returns the value of attribute coverage_formatter_options.
33 34 35 |
# File 'lib/openapi_first/test/configuration.rb', line 33 def @coverage_formatter_options end |
#ignore_unknown_requests ⇒ Object
Returns the value of attribute ignore_unknown_requests.
33 34 35 |
# File 'lib/openapi_first/test/configuration.rb', line 33 def ignore_unknown_requests @ignore_unknown_requests end |
#ignored_unknown_status ⇒ Object (readonly)
Returns the value of attribute ignored_unknown_status.
35 36 37 |
# File 'lib/openapi_first/test/configuration.rb', line 35 def ignored_unknown_status @ignored_unknown_status end |
#minimum_coverage ⇒ Object
Returns the value of attribute minimum_coverage.
35 36 37 |
# File 'lib/openapi_first/test/configuration.rb', line 35 def minimum_coverage @minimum_coverage end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
35 36 37 |
# File 'lib/openapi_first/test/configuration.rb', line 35 def registry @registry end |
#report_coverage ⇒ Object
Returns the value of attribute report_coverage.
35 36 37 |
# File 'lib/openapi_first/test/configuration.rb', line 35 def report_coverage @report_coverage end |
#response_raise_error ⇒ Object
Returns the value of attribute response_raise_error.
33 34 35 |
# File 'lib/openapi_first/test/configuration.rb', line 33 def response_raise_error @response_raise_error end |
Instance Method Details
#observe(app, api: :default) ⇒ Object
Observe a rack app
29 30 31 |
# File 'lib/openapi_first/test/configuration.rb', line 29 def observe(app, api: :default) (@apps[api] ||= []) << app end |
#register(oad, as: :default) ⇒ Object
Register OADs, but don’t load them just yet
24 25 26 |
# File 'lib/openapi_first/test/configuration.rb', line 24 def register(oad, as: :default) @registry[as] = oad end |
#skip_coverage(&block) ⇒ Object
61 62 63 64 65 |
# File 'lib/openapi_first/test/configuration.rb', line 61 def skip_coverage(&block) return @skip_coverage unless block_given? @skip_coverage = block end |
#skip_response_coverage(&block) ⇒ Object
55 56 57 58 59 |
# File 'lib/openapi_first/test/configuration.rb', line 55 def skip_response_coverage(&block) return @skip_response_coverage unless block_given? @skip_response_coverage = block end |