Class: Trailblazer::Test::Assertion::AssertPass::Passed
- Inherits:
-
Object
- Object
- Trailblazer::Test::Assertion::AssertPass::Passed
- Defined in:
- lib/trailblazer/test/assertion/assert_pass.rb
Instance Method Summary collapse
-
#arguments_for_assertion(signal) ⇒ Object
What needs to be compared?.
- #assertion(expected_outcome, actual_outcome, error_msg, test:) ⇒ Object
-
#call(signal, ctx, **options) ⇒ Object
Check if the operation terminates on :success.
- #error_message(signal, ctx, operation:) ⇒ Object
Instance Method Details
#arguments_for_assertion(signal) ⇒ Object
What needs to be compared?
32 33 34 |
# File 'lib/trailblazer/test/assertion/assert_pass.rb', line 32 def arguments_for_assertion(signal) return true, Assertion::SUCCESS_TERMINI.include?(signal.to_h[:semantic]) end |
#assertion(expected_outcome, actual_outcome, error_msg, test:) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/trailblazer/test/assertion/assert_pass.rb', line 42 def assertion(expected_outcome, actual_outcome, error_msg, test:, **) test.assert_equal( expected_outcome, actual_outcome, error_msg ) end |
#call(signal, ctx, **options) ⇒ Object
Check if the operation terminates on :success. @semi-public Used in rspec-trailblazer
23 24 25 26 27 28 29 |
# File 'lib/trailblazer/test/assertion/assert_pass.rb', line 23 def call(signal, ctx, **) expected_outcome, actual_outcome = arguments_for_assertion(signal) error_msg = (signal, ctx, **) # DISCUSS: compute error message before there was an error? outcome = assertion(expected_outcome, actual_outcome, error_msg, **) return outcome, error_msg end |
#error_message(signal, ctx, operation:) ⇒ Object
36 37 38 39 40 |
# File 'lib/trailblazer/test/assertion/assert_pass.rb', line 36 def (signal, ctx, operation:, **) colored_errors = Errors.colored_errors_for(ctx) %{{#{operation}} failed: #{colored_errors}} # FIXME: only if contract's there! end |