Class: BloodContracts::Runner
- Inherits:
-
Object
- Object
- BloodContracts::Runner
- Extended by:
- Dry::Initializer
- Defined in:
- lib/blood_contracts/runner.rb
Direct Known Subclasses
Instance Method Summary collapse
- #call ⇒ Object
-
#description ⇒ Object
FIXME: Move to locales.
-
#failure_message ⇒ Object
FIXME: Move to locales.
Instance Method Details
#call ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/blood_contracts/runner.rb', line 32 def call return false if :halt == catch(:unexpected_behavior) do iterator.next do next if match_rules?(matches_storage: statistics) do input = suite.data_generator.call [input, checking_proc.call(input)] end throw :unexpected_behavior, :halt if stop_on_unexpected end end validator.valid?(statistics) end |
#description ⇒ Object
FIXME: Move to locales
61 62 63 64 65 |
# File 'lib/blood_contracts/runner.rb', line 61 def description "meet the contract:\n#{contract_description} \n"\ " during #{iterator.count} run(s). Stats:\n#{statistics}\n\n"\ "For further investigations open: #{storage.suggestion}\n" end |
#failure_message ⇒ Object
FIXME: Move to locales
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/blood_contracts/runner.rb', line 46 def intro = "expected that given Proc would meet the contract:" if stats.unexpected_behavior? "#{intro}\n#{contract_description}\n"\ " during #{iterator.count} run(s) but got unexpected behavior.\n\n"\ "For further investigations open: #{storage.unexpected_suggestion}" else "#{intro}\n#{contract_description}\n"\ " during #{iterator.count} run(s) but got:\n#{statistics}\n\n"\ "For further investigations open: #{storage.suggestion}" end end |