Class: RSpec::Support::Differ

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec-difftastic.rb

Constant Summary collapse

DIFFTASTIC_DIFFER =
Difftastic::Differ.new(
  background: :dark,
  color: :always,
  left_label: "Expected",
  right_label: "Actual"
)

Instance Method Summary collapse

Instance Method Details

#diff_as_object(actual, expected) ⇒ Object



19
20
21
22
# File 'lib/rspec-difftastic.rb', line 19

def diff_as_object(actual, expected)
   diff_string = DIFFTASTIC_DIFFER.diff_objects(actual, expected)
  "\n\n#{diff_string}\n"
end

#diff_as_string(actual, expected) ⇒ Object



14
15
16
17
# File 'lib/rspec-difftastic.rb', line 14

def diff_as_string(actual, expected)
  diff_string = DIFFTASTIC_DIFFER.diff_strings(actual, expected)
  "\n\n#{diff_string}\n"
end