Module: Rspec::HtmlMessages::DiffFormatter
- Included in:
- Rspec::HtmlMessages
- Defined in:
- lib/rspec/html_messages/diff_formatter.rb
Instance Method Summary collapse
-
#create_diff(actual_value, expected_value) ⇒ Object
Creates side-by-side HTML diff using Diffy Note: Diffy generates safe HTML with properly escaped content, so we render it unescaped in templates.
- #effective_diffable?(force_diffable: [], force_not_diffable: []) ⇒ Boolean
Instance Method Details
#create_diff(actual_value, expected_value) ⇒ Object
Creates side-by-side HTML diff using Diffy Note: Diffy generates safe HTML with properly escaped content, so we render it unescaped in templates
17 18 19 20 21 22 23 24 |
# File 'lib/rspec/html_messages/diff_formatter.rb', line 17 def create_diff(actual_value, expected_value) split_diff = Diffy::SplitDiff.new(actual_value, expected_value, format: :html) { left: split_diff.left, right: split_diff.right } end |
#effective_diffable?(force_diffable: [], force_not_diffable: []) ⇒ Boolean
8 9 10 11 12 13 |
# File 'lib/rspec/html_messages/diff_formatter.rb', line 8 def effective_diffable?(force_diffable: [], force_not_diffable: []) return true if force_diffable&.include?(matcher_name) return false if force_not_diffable&.include?(matcher_name) details["diffable"] end |