Sha256: 45215b16a6f3166842c6371edcae4c8905af042350164778116a5eda2a1d6b4b
Contents?: true
Size: 945 Bytes
Versions: 2
Compression:
Stored size: 945 Bytes
Contents
require 'spec/helper' 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_error(ArgumentError, "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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ramaze-0.2.0 | spec/snippets/array/put_within.rb |
ramaze-0.2.1 | spec/snippets/array/put_within.rb |