Module: TestRecorder::RSpec
- Defined in:
- lib/test_recorder/rspec.rb,
lib/test_recorder/rspec/example_wrapper.rb
Defined Under Namespace
Modules: ExampleWrapper
Class Attribute Summary collapse
-
.cdp_recorder ⇒ Object
Returns the value of attribute cdp_recorder.
Class Method Summary collapse
Class Attribute Details
.cdp_recorder ⇒ Object
Returns the value of attribute cdp_recorder.
8 9 10 |
# File 'lib/test_recorder/rspec.rb', line 8 def cdp_recorder @cdp_recorder end |
Class Method Details
.after_failed_example(example) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/test_recorder/rspec.rb', line 10 def after_failed_example(example) if passed?(example) cdp_recorder.stop_and_discard else video_path = cdp_recorder.stop_and_save("failures_#{method_name(example)}.webm").to_s if File.exist?(video_path) example.[:extra_failure_lines] = [example.[:extra_failure_lines], "[Video]: #{video_path}"].flatten end end end |
.method_name(example) ⇒ Object
21 22 23 |
# File 'lib/test_recorder/rspec.rb', line 21 def method_name(example) TestRecorder.sanitize_filename(example.description.underscore)[0...200] + "_#{rand(1000)}" end |
.passed?(example) ⇒ Boolean
25 26 27 28 29 30 31 32 33 |
# File 'lib/test_recorder/rspec.rb', line 25 def passed?(example) return false if example.exception return true unless defined?(::RSpec::Expectations::FailureAggregator) failure_notifier = ::RSpec::Support.failure_notifier return true unless failure_notifier.is_a?(::RSpec::Expectations::FailureAggregator) failure_notifier.failures.empty? && failure_notifier.other_errors.empty? end |