Module: RSpec::Risky
- Defined in:
- lib/rspec/risky.rb,
lib/rspec/risky/verdict.rb,
lib/rspec/risky/version.rb,
lib/rspec/risky/formatter.rb,
lib/rspec/risky/rspec_cli.rb,
lib/rspec/risky/evaluation.rb,
lib/rspec/risky/configuration.rb,
lib/rspec/risky/json_formatter.rb,
lib/rspec/risky/minitest/plugin.rb,
lib/rspec/risky/static_detector.rb,
lib/rspec/risky/probe/fd_capture.rb,
lib/rspec/risky/minitest/reporter.rb,
lib/rspec/risky/probe/output_probe.rb,
lib/rspec/risky/probe/recording_io.rb,
lib/rspec/risky/probe/output_report.rb,
lib/rspec/risky/json_event_formatter.rb,
lib/rspec/risky/minitest/output_capture.rb,
lib/rspec/risky/probe/expectation_probe.rb,
sig/rspec/risky.rbs
Defined Under Namespace
Modules: Evaluation, Minitest, Probe, RSpecCli, Verdict
Classes: Configuration, Error, Formatter, JsonEventFormatter, JsonFormatter, RedundantPrintConfig, RiskyExampleError, RuleConfig, RuleResult, StaticDetector, UnknownTestConfig
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
31
32
33
|
# File 'lib/rspec/risky.rb', line 31
def configuration
@configuration ||= Configuration.new
end
|
Class Method Details
39
40
41
42
43
44
45
46
|
# File 'lib/rspec/risky.rb', line 39
def configure(rspec_configuration = nil)
yield configuration if block_given?
install!
integrate!(rspec_configuration || default_rspec_configuration)
configuration
end
|
.record_expectation(count = 1) ⇒ void
This method returns an undefined value.
.risky_results ⇒ Object
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/rspec/risky.rb', line 89
def risky_results
return [] unless defined?(::RSpec::Core)
::RSpec.world.all_examples.filter_map do |example|
result = example.metadata[:rspec_risky]
next unless result
[example, result]
end
end
|
.run_example(example_procsy) ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/rspec/risky.rb', line 58
def run_example(example_procsy)
example = example_procsy.example
expectation_state = Probe::ExpectationProbe.start(example)
output_state = start_output_probe
begin
example_procsy.run
ensure
output_report = Probe::OutputProbe.finish(output_state)
expectation_report = Probe::ExpectationProbe.finish(expectation_state)
expectation_report.custom_expectation_count += configuration.unknown_test.adapter_count(example)
verdicts = Verdict.evaluate(
example: example,
configuration: configuration,
expectations: expectation_report,
output: output_report
)
example.metadata[:rspec_risky] = {
custom_expectation_count: expectation_report.custom_expectation_count,
expectation_count: expectation_report.expectation_count,
mock_expectation_count: expectation_report.mock_expectation_count,
output: output_report,
verdicts: verdicts
}
end
fail_verdicts = verdicts.select { |verdict| verdict.severity == :fail }
raise RiskyExampleError.new(fail_verdicts) if fail_verdicts.any? && !example.exception
end
|