Sha256: c6c6e09987c46a74639dd42c08175c9afaa5f82bc8231b6390d08c930cc0a137
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the MIT 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ramaze-2012.04.14 | spec/snippets/array/put_within.rb |
ramaze-2012.03.07 | spec/snippets/array/put_within.rb |