Class: Cornucopia::RSpecHelper
- Inherits:
-
Object
- Object
- Cornucopia::RSpecHelper
- Includes:
- Singleton
- Defined in:
- lib/cornucopia/rspec_hooks.rb
Instance Attribute Summary collapse
-
#context_seed_value ⇒ Object
Returns the value of attribute context_seed_value.
-
#last_reported_example ⇒ Object
Returns the value of attribute last_reported_example.
-
#seed_value ⇒ Object
Returns the value of attribute seed_value.
-
#suite_seed_value ⇒ Object
Returns the value of attribute suite_seed_value.
Instance Method Summary collapse
- #end_example(example) ⇒ Object
-
#initialize ⇒ RSpecHelper
constructor
A new instance of RSpecHelper.
Constructor Details
#initialize ⇒ RSpecHelper
Returns a new instance of RSpecHelper.
18 19 20 |
# File 'lib/cornucopia/rspec_hooks.rb', line 18 def initialize @last_reported_example = nil end |
Instance Attribute Details
#context_seed_value ⇒ Object
Returns the value of attribute context_seed_value.
15 16 17 |
# File 'lib/cornucopia/rspec_hooks.rb', line 15 def context_seed_value @context_seed_value end |
#last_reported_example ⇒ Object
Returns the value of attribute last_reported_example.
13 14 15 |
# File 'lib/cornucopia/rspec_hooks.rb', line 13 def last_reported_example @last_reported_example end |
#seed_value ⇒ Object
Returns the value of attribute seed_value.
16 17 18 |
# File 'lib/cornucopia/rspec_hooks.rb', line 16 def seed_value @seed_value end |
#suite_seed_value ⇒ Object
Returns the value of attribute suite_seed_value.
14 15 16 |
# File 'lib/cornucopia/rspec_hooks.rb', line 14 def suite_seed_value @suite_seed_value end |
Instance Method Details
#end_example(example) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cornucopia/rspec_hooks.rb', line 22 def end_example(example) unless example == last_reported_example if (example.exception) @last_reported_example = example puts("random seed for testing was: #{suite_seed_value}, #{context_seed_value}, #{seed_value}") Cornucopia::Util::ReportBuilder.current_report. within_section("Test Error: #{example.full_description}") do |report| configured_report = Cornucopia::Util::Configuration.report_configuration :rspec configured_report.add_report_objects example: example, rspec: RSpec, seeds: self configured_report.generate_report(report) end end end end |