Sha256: df4a83858f4118893857cd123db6008de6870a1d7348c105141c408ac1fce2e2
Contents?: true
Size: 875 Bytes
Versions: 2
Compression:
Stored size: 875 Bytes
Contents
require File.expand_path('../../spec_helper', File.dirname(__FILE__)) require 'hamster/list' describe Hamster do describe "#cycle" do it "is lazy" do lambda { Hamster.stream { fail }.cycle }.should_not raise_error end describe "with an empty list" do before do original = Hamster.list @result = original.cycle end it "returns an empty list" do @result.should be_empty end end describe "with a non-empty list" do before do @original = Hamster.list("A", "B", "C") @result = @original.cycle end it "preserves the original" do @original.should == Hamster.list("A", "B", "C") end it "infinitely cycles through all values" do @result.take(7).should == Hamster.list("A", "B", "C", "A", "B", "C", "A") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.2.7 | spec/hamster/list/cycle_spec.rb |
hamster-0.2.6 | spec/hamster/list/cycle_spec.rb |