Sha256: d0332efcd4af4c2aadf06e38e18c5a6c4738716b725fbbb2f840cbba1b9adab3
Contents?: true
Size: 1.86 KB
Versions: 1
Compression:
Stored size: 1.86 KB
Contents
require 'spec_helper' describe Differ::Change do before(:each) do @format = Module.new { def self.call(c); end } Differ.format = @format end describe '(empty)' do before(:each) do @change = Differ::Change.new() end it 'should have a default insert' do expect(@change.insert).to eq('') end it 'should have a default delete' do expect(@change.delete).to eq('') end it 'should stringify to ""' do expect(@format).to receive(:call).once.and_return('') expect(@change.to_s).to eq('') end end describe '(insert only)' do before(:each) do @change = Differ::Change.new(:insert => 'foo') end it 'should populate the :insert parameter' do expect(@change.insert).to eq('foo') end it 'should have a default delete' do expect(@change.delete).to eq('') end it { expect(@change).to be_an_insert } end describe '(delete only)' do before(:each) do @change = Differ::Change.new(:delete => 'bar') end it 'should have a default :insert' do expect(@change.insert).to eq('') end it 'should populate the :delete parameter' do expect(@change.delete).to eq('bar') end it { expect(@change).to be_a_delete } end describe '(both insert and delete)' do before(:each) do @change = Differ::Change.new(:insert => 'foo', :delete => 'bar') end it 'should populate the :insert parameter' do expect(@change.insert).to eq('foo') end it 'should populate the :delete parameter' do expect(@change.delete).to eq('bar') end it { expect(@change).to be_an_insert } it { expect(@change).to be_a_delete } it { expect(@change).to be_a_change } end it "should stringify via the current format's #format method" do expect(@format).to receive(:call).once Differ::Change.new.to_s end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ninja-differ-1.0.0 | spec/differ/change_spec.rb |