Sha256: 77141086df023487b55ea5a47536f505f556f9254d34cb9b1849e8d3b18996a0

Contents?: true

Size: 918 Bytes

Versions: 7

Compression:

Stored size: 918 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'lib', 'tadpole')

describe Array do
  describe '#place' do
    it "should create an Insertion object" do
      [].place('x').should be_kind_of(Insertion)
    end
  end
end

describe Insertion do
  describe '#before' do
    it "should place an object before another" do
      [1, 2].place(3).before(2).should == [1, 3, 2]
      [1, 2].place(3).before(1).should == [3, 1, 2]
      [1, [4], 2].place(3).before(2).should == [1, [4], 3, 2]
    end
  end
  
  describe '#after' do
    it "should place an object after another" do
      [1, 2].place(3).after(2).should == [1, 2, 3]
    end

    it "should place an object after another and its subsections" do
      [1, [2]].place(3).after(1).should == [1, [2], 3]
    end

    it "should not not ignore subsections if ignore_subections=false" do
      [1, [2]].place(3).after(1, false).should == [1, 3, [2]]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tadpole-0.1.7 spec/array_spec.rb
tadpole-0.1.1 spec/array_spec.rb
tadpole-0.1.2 spec/array_spec.rb
tadpole-0.1.3 spec/array_spec.rb
tadpole-0.1.4 spec/array_spec.rb
tadpole-0.1.5 spec/array_spec.rb
tadpole-0.1.6 spec/array_spec.rb