Sha256: 185ad1321e4ef3448c42f3353dfda7fabcc69adc83b3289f2a6d017739363c27

Contents?: true

Size: 1.41 KB

Versions: 16

Compression:

Stored size: 1.41 KB

Contents

require "spec/spec_helper"

describe Irwi::Comparators::DiffLcs do
        
  before(:each) do
    @c = Irwi::Comparators::DiffLcs.new
  end
     
  specify "should render change for replaced text" do
    @c.render_changes('AAA','BbB').should == '<span class="removed">AAA</span><span class="added">BbB</span>'
  end
  
  specify "should render no changes for same text" do
    @c.render_changes('vdsds','vdsds').should == 'vdsds'
  end
  
  specify "should render addition" do
    @c.render_changes('AAA','AABbA').should == 'AA<span class="added">Bb</span>A'
  end
  
  specify "should render deletion" do
    @c.render_changes('AdvsADA','AdDA').should == 'Ad<span class="removed">vsA</span>DA'
  end

  specify "should render changed with addition" do
    @c.render_changes('qwerty','qwasdfy').should == 'qw<span class="removed">ert</span><span class="added">asdf</span>y'
  end
  
  specify "should survive on nil in old" do
    @c.render_changes(nil,'AdDA').should == '<span class="added">AdDA</span>'
  end
  
  specify "should survive on nil in new" do
    @c.render_changes('AdDA',nil).should == '<span class="removed">AdDA</span>'
  end
  
  specify "should change \\n to <br />" do
    @c.render_changes("AdDA\nhhh",'').should == '<span class="removed">AdDA<br />hhh</span>'
  end
  
  specify "should change \\r\\n to <br />" do
    @c.render_changes("AdDA\r\nhhh",'').should == '<span class="removed">AdDA<br />hhh</span>'
  end
  
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
irwi-0.2.4 spec/comparators/diff_lcs_spec.rb
irwi-0.2.3 spec/comparators/diff_lcs_spec.rb
irwi-0.2.2 spec/comparators/diff_lcs_spec.rb
irwi-0.2.1 spec/comparators/diff_lcs_spec.rb
irwi-0.2.0 spec/comparators/diff_lcs_spec.rb
irwi-0.1.11 spec/comparators/diff_lcs_spec.rb
irwi-0.1.10 spec/comparators/diff_lcs_spec.rb
irwi-0.1.9 spec/comparators/diff_lcs_spec.rb
irwi-0.1.7 spec/comparators/diff_lcs_spec.rb
irwi-0.1.6 spec/comparators/diff_lcs_spec.rb
irwi-0.1.5 spec/comparators/diff_lcs_spec.rb
irwi-0.1.4 spec/comparators/diff_lcs_spec.rb
irwi-0.1.3 spec/comparators/diff_lcs_spec.rb
irwi-0.1.2 spec/comparators/diff_lcs_spec.rb
irwi-0.1.1 spec/comparators/diff_lcs_spec.rb
irwi-0.1.0 spec/comparators/diff_lcs_spec.rb