Sha256: c80fc40b0d00dacd122d8f152790e05769963d1577eb22b83419f3e2c8a33b84

Contents?: true

Size: 699 Bytes

Versions: 7

Compression:

Stored size: 699 Bytes

Contents

require "spec_helper"

describe Array do
	describe "#first!" do
		it "runs ok" do
			a = [0, 1, 2]
			a.first!(2).should == [0, 1]
			a.should == [2]
		end
	end

	describe "#last!" do
		it "runs ok" do
			a = [0, 1, 2]
			a.last!(2).should == [1, 2]
			a.should == [0]
		end
	end

	describe "#find!" do
		it "runs ok" do
			a = [0, 1, 2]
			a.find!{|v| v==1}.should == 1
			a.should == [0,2]
		end
	end

	describe "#find_all!" do
		it "runs ok" do
			a = [0, 1, 2]
			a.find_all!{|v| v==0 or v ==2}.should == [0,2]
			a.should == [1]
		end
	end

  #describe "#grep" do
    #it "supports array as an argument" do
      #a = [:a, :b, :c]
      #a.grep([:a, :b]).should == [:a, :b]
    #end
  #end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tagen-1.1.7 spec/tagen/core/array_spec.rb
tagen-1.1.6 spec/tagen/core/array_spec.rb
tagen-1.1.5 spec/tagen/core/array_spec.rb
tagen-1.1.4 spec/tagen/core/array_spec.rb
tagen-1.1.3 spec/tagen/core/array_spec.rb
tagen-1.1.2 spec/tagen/core/array_spec.rb
tagen-1.1.1 spec/tagen/core/array_spec.rb