Sha256: ddaab651286fa2dd7237025539717a131719e2320ea32eaa0a26e5c5001132ac

Contents?: true

Size: 807 Bytes

Versions: 5

Compression:

Stored size: 807 Bytes

Contents

require File.dirname(__FILE__) + '/helper'
require 'cgi'

class DiffTest < Test::Unit::TestCase
  context "Pretty Diff" do
  
    setup do
      @small_diff = PrettyDiff::Diff.new read_diff('first.diff')
      @big_diff   = PrettyDiff::Diff.new read_diff('second.diff')
    end
    
    should "generate correct amount of chunks for each diff" do
      assert_equal 2, @small_diff.send(:chunks).size
      assert_equal 4, @big_diff.send(:chunks).size
    end
    
    should "generate HTML representation without errors" do
      assert @small_diff.to_html
      assert @big_diff.to_html
    end
    
    should "escape HTML from the input string" do
      text = "<b>Funky HTML</b>"
      diff = PrettyDiff::Diff.new(text)
      assert_equal "&lt;b&gt;Funky HTML&lt;/b&gt;", diff.input
    end
  
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pretty_diff-0.6.0 test/diff_test.rb
pretty_diff-0.5.0 test/diff_test.rb
pretty_diff-0.4.0 test/diff_test.rb
pretty_diff-0.3.1 test/diff_test.rb
pretty_diff-0.3.0 test/diff_test.rb