Sha256: ea45338a5ba6f7d4e5b8e1e58f8414b8cbbe9f3d416f63ea3d30e8a3c06cc979

Contents?: true

Size: 983 Bytes

Versions: 40

Compression:

Stored size: 983 Bytes

Contents

require 'lib/ramaze/spec/helper/snippets'

describe 'Array#put_within' do
  it 'should put a given object at a well-described position' do
    array = [:foo, :bar, :baz]
    array.put_within(:foobar, :after => :bar, :before => :baz)
    array.should == [:foo, :bar, :foobar, :baz]
  end

  it 'should raise on uncertainity' do
    array = [:foo, :bar, :baz]
    lambda{
      array.put_within(:foobar, :after => :foo, :before => :baz)
    }.should.raise(ArgumentError).
      message.should == "Too many elements within constrain"
  end
end

describe 'Array#put_after' do
  it 'should put a given object at a well-described position' do
    array = [:foo, :bar, :baz]
    array.put_after(:bar, :foobar)
    array.should == [:foo, :bar, :foobar, :baz]
  end
end

describe 'Array#put_within' do
  it 'should put a given object at a well-described position' do
    array = [:foo, :bar, :baz]
    array.put_before(:bar, :foobar)
    array.should == [:foo, :foobar, :bar, :baz]
  end
end

Version data entries

40 entries across 40 versions & 6 rubygems

Version Path
Pistos-ramaze-2008.09 spec/snippets/array/put_within.rb
Pistos-ramaze-2008.12 spec/snippets/array/put_within.rb
Pistos-ramaze-2009.01 spec/snippets/array/put_within.rb
Pistos-ramaze-2009.02 spec/snippets/array/put_within.rb
Pistos-ramaze-2009.04.08 spec/snippets/array/put_within.rb
clivecrous-ramaze-0.3.9.5 spec/snippets/array/put_within.rb
manveru-ramaze-2008.07 spec/snippets/array/put_within.rb
manveru-ramaze-2008.08 spec/snippets/array/put_within.rb
manveru-ramaze-2008.09 spec/snippets/array/put_within.rb
manveru-ramaze-2008.10 spec/snippets/array/put_within.rb
manveru-ramaze-2008.12 spec/snippets/array/put_within.rb
manveru-ramaze-2009.01 spec/snippets/array/put_within.rb
manveru-ramaze-2009.04.01 spec/snippets/array/put_within.rb
manveru-ramaze-2009.04.08 spec/snippets/array/put_within.rb
manveru-ramaze-2009.04.18 spec/snippets/array/put_within.rb
manveru-ramaze-2009.04.22 spec/snippets/array/put_within.rb
manveru-ramaze-2009.04 spec/snippets/array/put_within.rb
manveru-ramaze-2009.05.08 spec/snippets/array/put_within.rb
manveru-ramaze-2009.05 spec/snippets/array/put_within.rb
manveru-ramaze-2009.06.04 spec/snippets/array/put_within.rb