Sha256: 5dd2cbbdebd5fe25d5389cda7eb7f9c254a6286fcf55ea925c868c83d1bc5e2f

Contents?: true

Size: 1.19 KB

Versions: 14

Compression:

Stored size: 1.19 KB

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)

describe 'Array' do
  describe '#put_within' do
    it 'puts 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 'raises 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 '#put_after' do
    it 'puts 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 '#put_within' do
    it 'puts 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
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.06.12 spec/snippets/array/put_within.rb
manveru-ramaze-2009.07 spec/snippets/array/put_within.rb
ramaze-2011.12.28 spec/snippets/array/put_within.rb
ramaze-2011.10.23 spec/snippets/array/put_within.rb
ramaze-2011.07.25 spec/snippets/array/put_within.rb
ramaze-2011.01.30 spec/snippets/array/put_within.rb
ramaze-2011.01 spec/snippets/array/put_within.rb
ramaze-2010.06.18 spec/snippets/array/put_within.rb
ramaze-2010.04.04 spec/snippets/array/put_within.rb
ramaze-2010.04 spec/snippets/array/put_within.rb
ramaze-2010.03 spec/snippets/array/put_within.rb
ramaze-2010.01 spec/snippets/array/put_within.rb
ramaze-2009.10 spec/snippets/array/put_within.rb
ramaze-2009.07 spec/snippets/array/put_within.rb