Class: RSpec::CoverIt::Context
- Inherits:
-
Object
- Object
- RSpec::CoverIt::Context
- Defined in:
- lib/rspec/cover_it/context.rb
Instance Method Summary collapse
- #cover_it? ⇒ Boolean
-
#initialize(scope:, rspec_context:, autoenforce:) ⇒ Context
constructor
A new instance of Context.
- #scope_name ⇒ Object
- #specific_threshold ⇒ Object
- #target_class ⇒ Object
- #target_path ⇒ Object
Constructor Details
#initialize(scope:, rspec_context:, autoenforce:) ⇒ Context
Returns a new instance of Context.
4 5 6 |
# File 'lib/rspec/cover_it/context.rb', line 4 def initialize(scope:, rspec_context:, autoenforce:) @scope, @rspec_context, @autoenforce = scope, rspec_context, autoenforce end |
Instance Method Details
#cover_it? ⇒ Boolean
8 9 10 11 12 |
# File 'lib/rspec/cover_it/context.rb', line 8 def cover_it? target_class && .fetch(:cover_it, autoenforce?) && completeness_checker.running_all_examples? end |
#scope_name ⇒ Object
27 28 29 |
# File 'lib/rspec/cover_it/context.rb', line 27 def scope_name scope.file_path end |
#specific_threshold ⇒ Object
14 15 16 17 |
# File 'lib/rspec/cover_it/context.rb', line 14 def specific_threshold = .fetch(:cover_it, nil) .is_a?(Numeric) ? / 100.0 : nil end |
#target_class ⇒ Object
23 24 25 |
# File 'lib/rspec/cover_it/context.rb', line 23 def target_class .fetch(:described_class, nil) end |
#target_path ⇒ Object
19 20 21 |
# File 'lib/rspec/cover_it/context.rb', line 19 def target_path .key?(:covers_path) ? : inferred_path end |