Sha256: 78efcc8f22660b56463ffcf20d19d49c8b875194a0569da9a6c7af7f827fc0a0

Contents?: true

Size: 667 Bytes

Versions: 2

Compression:

Stored size: 667 Bytes

Contents

describe "Enumerable#drop_while" do
  before :each do
    @enum = EnumerableSpecs::Numerous.new(3, 2, 1, :go)
  end

  it "returns an Enumerator if no block given" do
    @enum.drop_while.should be_kind_of(Enumerator)
  end

  it "returns no/all elements for {true/false} block" do
    @enum.drop_while {true}.should == []
    @enum.drop_while {false}.should == @enum.to_a
  end

  it "accepts returns other than true/false" do
    @enum.drop_while{1}.should == []
    @enum.drop_while{nil}.should == @enum.to_a
  end

  it "passed elements to the block until the first false" do
    a = []
    @enum.drop_while{|obj| (a << obj).size < 3}.should == [1, :go]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-0.3.20 test/core/enumerable/drop_while_spec.rb
opal-0.3.19 test/core/enumerable/drop_while_spec.rb