Sha256: 396155abd2dad13db7b9d18bbfb6f79aa8e8bb628214ad24e1855083b5ee5000

Contents?: true

Size: 1.11 KB

Versions: 68

Compression:

Stored size: 1.11 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

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 no longer place an object after another and its subsections (0.6)" do
      [1, [2]].place(3).after(1).should == [1, 3, [2]]
    end

    it "should place an array after an object" do
      [1, 2, 3].place([4]).after(1).should == [1, [4], 2, 3]
    end
  end

  describe '#before_any' do
    it "should place an object before another anywhere inside list (including sublists)" do
      [1, 2, [3]].place(4).before_any(3).should == [1, 2, [4, 3]]
    end
  end

  describe '#after_any' do
    it "should place an object after another anywhere inside list (including sublists)" do
      [1, 2, [3]].place(4).after_any(3).should == [1, 2, [3, 4]]
    end
  end
end

Version data entries

68 entries across 52 versions & 7 rubygems

Version Path
yard-0.8.7.6 spec/core_ext/insertion_spec.rb
yard-0.8.7.5 spec/core_ext/insertion_spec.rb
climine-0.0.7 vendor/bundle/ruby/2.1.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
climine-0.0.7 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
climine-0.0.6 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
climine-0.0.5 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
yard-0.8.7.4 spec/core_ext/insertion_spec.rb
climine-0.0.4 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
climine-0.0.3 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/core_ext/insertion_spec.rb
yard-0.8.7.3 spec/core_ext/insertion_spec.rb
yard-0.8.7.2 spec/core_ext/insertion_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/yard-0.8.7/spec/core_ext/insertion_spec.rb
candlepin-api-0.4.0 bundle/ruby/gems/yard-0.8.7/spec/core_ext/insertion_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/yard-0.8.7/spec/core_ext/insertion_spec.rb
yard-0.8.7.1 spec/core_ext/insertion_spec.rb