Sha256: d2420113cf98b5d03891f431d7c8782b6ec1233006b061093b67f78eaade8ba8

Contents?: true

Size: 775 Bytes

Versions: 7

Compression:

Stored size: 775 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

require 'set'
require 'hamster/set'

describe Hamster::Set do

  [:each, :foreach].each do |method|

    describe "##{method}" do

      before do
        @set = Hamster.set("A", "B", "C")
      end

      describe "with a block (internal iteration)" do

        it "returns nil" do
          @set.send(method) {}.should be_nil
        end

        it "yields all values" do
          actual_values = Set[]
          @set.send(method) { |value| actual_values << value }
          actual_values.should == Set["A", "B", "C"]
        end

      end

      describe "with no block" do

        it "returns self" do
          @set.send(method).should equal(@set)
        end

      end

    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hamster-0.2.5 spec/hamster/set/each_spec.rb
hamster-0.2.4 spec/hamster/set/each_spec.rb
hamster-0.2.3 spec/hamster/set/each_spec.rb
hamster-0.2.2 spec/hamster/set/each_spec.rb
hamster-0.2.1 spec/hamster/set/each_spec.rb
hamster-0.2.0 spec/hamster/set/each_spec.rb
hamster-0.1.23 spec/hamster/set/each_spec.rb