Class: RSpec::Hermetic::Runner
- Inherits:
-
Object
- Object
- RSpec::Hermetic::Runner
- Defined in:
- lib/rspec/hermetic/runner.rb
Instance Attribute Summary collapse
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Instance Method Summary collapse
- #call(example, context) ⇒ Object
-
#initialize(configuration) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(configuration) ⇒ Runner
Returns a new instance of Runner.
17 18 19 20 21 22 23 |
# File 'lib/rspec/hermetic/runner.rb', line 17 def initialize(configuration) @configuration = configuration @records = [] @suite_baseline = nil @last_writers = {} @example_count = 0 end |
Instance Attribute Details
#records ⇒ Object (readonly)
Returns the value of attribute records.
15 16 17 |
# File 'lib/rspec/hermetic/runner.rb', line 15 def records @records end |
Instance Method Details
#call(example, context) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rspec/hermetic/runner.rb', line 25 def call(example, context) @example_count += 1 probes = build_probes before = Snapshot.capture(probes, context: context) @suite_baseline ||= before ResourceTracker.start! if @configuration.track_resource_origins example.run ensure if before after = Snapshot.capture(probes, context: context) ResourceTracker.stop! if @configuration.track_resource_origins change_set = Diff.between(before, after) result = Verdict.new(@configuration).call( change_set, example_allowances: example_allowances(example) ) record(example, change_set, result) report_pollution(example, change_set, result) report_probe_errors(example, change_set, result) report_forensic_victim(example, before) if @configuration.forensic && failed?(example) remember_writers(example, change_set) restore_state(change_set, before, context) fail_example!(example, result, change_set) if should_fail_for_pollution?(example, result) end end |