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
manveru-ramaze-2009.06.12 spec/snippets/array/put_within.rb
manveru-ramaze-2009.06 spec/snippets/array/put_within.rb
ptomato-ramaze-2009.02.1 spec/snippets/array/put_within.rb
ptomato-ramaze-2009.02 spec/snippets/array/put_within.rb
rjspotter-ramaze-2009.06.29 spec/snippets/array/put_within.rb
rjspotter-ramaze-2009.06.31 spec/snippets/array/put_within.rb
ramaze-0.3.5 spec/snippets/array/put_within.rb
ramaze-0.3.0 spec/snippets/array/put_within.rb
ramaze-2009.01 spec/snippets/array/put_within.rb
ramaze-2008.06 spec/snippets/array/put_within.rb
ramaze-0.3.9.1 spec/snippets/array/put_within.rb
ramaze-0.3.9 spec/snippets/array/put_within.rb
ramaze-2008.11 spec/snippets/array/put_within.rb
ramaze-2009.03 spec/snippets/array/put_within.rb
ramaze-2009.04 spec/snippets/array/put_within.rb
ramaze-2009.02 spec/snippets/array/put_within.rb
ramaze-2009.05 spec/snippets/array/put_within.rb
ramaze-2009.06.12 spec/snippets/array/put_within.rb
ramaze-2009.06.04 spec/snippets/array/put_within.rb
ramaze-2009.06 spec/snippets/array/put_within.rb