Class: RSpec::Covers::CheckedCoverage
- Inherits:
-
Object
- Object
- RSpec::Covers::CheckedCoverage
- Defined in:
- lib/rspec/covers/checked_coverage.rb
Instance Method Summary collapse
- #filter(executed_locations:, call_log:, expectation_object_ids:) ⇒ Object
-
#initialize(config) ⇒ CheckedCoverage
constructor
A new instance of CheckedCoverage.
Constructor Details
#initialize(config) ⇒ CheckedCoverage
Returns a new instance of CheckedCoverage.
10 11 12 |
# File 'lib/rspec/covers/checked_coverage.rb', line 10 def initialize(config) @inventory = ProductionInventory.new(config) end |
Instance Method Details
#filter(executed_locations:, call_log:, expectation_object_ids:) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rspec/covers/checked_coverage.rb', line 14 def filter(executed_locations:, call_log:, expectation_object_ids:) object_ids = (expectation_object_ids + call_log.expectation_object_ids).uniq return Set.new if object_ids.empty? && call_log.labels_before_expectations.empty? checked_labels = (call_log.return_labels_for(object_ids) + call_log.labels_before_expectations).uniq checked_locations = @inventory.methods_by_label(checked_labels).each_with_object(Set.new) do |entry, set| set.merge(entry.region.locations) end Set.new(executed_locations).select { |location| checked_locations.include?(location) }.to_set end |