Sha256: bf0fbd340b0c38d54bdec04464be0407940f4df65de6553aeb69771b1a7dd0f7

Contents?: true

Size: 868 Bytes

Versions: 3

Compression:

Stored size: 868 Bytes

Contents

require 'spec_helper'
require 'differ/string'

describe Differ::StringDiffer do
  it 'should be automatically mixed into String' do
    String.included_modules.should include(Differ::StringDiffer)
  end

  before(:each) do
    $; = nil
  end

  describe '#diff' do
    it 'should call Differ#diff' do
      Differ.should_receive(:diff).with('TO', 'FROM', "\n").once
      'TO'.diff('FROM')
    end

    it 'should call Differ#diff with $;' do
      $; = 'x'
      Differ.should_receive(:diff).with('TO', 'FROM', $;).once
      'TO'.diff('FROM')
    end
  end

  describe '#-' do
    it 'should call Differ#diff' do
      Differ.should_receive(:diff).with('TO', 'FROM', "\n").once
      'TO' - 'FROM'
    end

    it 'should call Differ#diff with $;' do
      $; = 'x'
      Differ.should_receive(:diff).with('TO', 'FROM', $;).once
      'TO' - 'FROM'
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
pvande-differ-0.1.1 spec/differ/string_spec.rb
differ-0.1.2 spec/differ/string_spec.rb
differ-0.1.1 spec/differ/string_spec.rb