Class: SuperDiff::RSpec::MatcherTextBuilders::Base
- Inherits:
-
Object
- Object
- SuperDiff::RSpec::MatcherTextBuilders::Base
- Defined in:
- lib/super_diff/rspec/matcher_text_builders/base.rb
Direct Known Subclasses
BePredicate, ContainExactly, HavePredicate, Match, RaiseError, RespondTo
Instance Method Summary collapse
- #call(negated:) ⇒ Object
-
#initialize(actual:, expected_for_failure_message:, expected_for_description:, expected_action_for_failure_message:, expected_action_for_description:) ⇒ Base
constructor
A new instance of Base.
- #matcher_description ⇒ Object
Constructor Details
#initialize(actual:, expected_for_failure_message:, expected_for_description:, expected_action_for_failure_message:, expected_action_for_description:) ⇒ Base
Returns a new instance of Base.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/super_diff/rspec/matcher_text_builders/base.rb', line 5 def initialize( actual:, expected_for_failure_message:, expected_for_description:, expected_action_for_failure_message:, expected_action_for_description: ) @actual = actual @expected_for_failure_message = @expected_for_description = expected_for_description @expected_action_for_failure_message = @expected_action_for_description = expected_action_for_description @negated = nil @template = MatcherTextTemplate.new end |
Instance Method Details
#call(negated:) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/super_diff/rspec/matcher_text_builders/base.rb', line 23 def call(negated:) @negated = negated fill_template template.to_s end |
#matcher_description ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/super_diff/rspec/matcher_text_builders/base.rb', line 30 def matcher_description template = MatcherTextTemplate.new do |t| t.add_text expected_action_for_description add_expected_value_to_description(t) add_extra_after_expected_to(t) end Csi.decolorize(template.to_s(as_single_line: true)) end |