Module: PrettyDiffs::ClassMethods

Defined in:
lib/pretty_diffs.rb

Instance Method Summary collapse

Instance Method Details

#boring_diffs?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/pretty_diffs.rb', line 30

def boring_diffs?
  ENV['MINITEST_PLAIN_BORING_DIFF'] == 'yes'
end

#enforce_color_diffsObject



22
23
24
# File 'lib/pretty_diffs.rb', line 22

def enforce_color_diffs
  Minitest::Assertions.diff = "wdiff -n -w '\033[0;31m' -x '\033[0m' -y '\033[0;32m' -z '\033[0m'"
end

#enforce_pretty_diffsObject



16
17
18
19
20
# File 'lib/pretty_diffs.rb', line 16

def enforce_pretty_diffs
  if verify_wdiff_in_path && !boring_diffs?
    enforce_color_diffs
  end
end

#verify_wdiff_in_pathObject



26
27
28
# File 'lib/pretty_diffs.rb', line 26

def verify_wdiff_in_path
  !%x{which wdiff}.empty?
end