Sha256: 061bb1fcb5fbcdac0ed254b69c84edb8f51d892d2f539391810a60d6a583a9b2

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 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

2 entries across 2 versions & 1 rubygems

Version Path
tagen-1.1.0 spec/tagen/core/array_spec.rb
tagen-1.0.4 spec/tagen/core/array_spec.rb