Sha256: 4c25ea4c893b2039e44e25132c8d28e2d821ca4d38f57b2c99fcf3390dd98075

Contents?: true

Size: 807 Bytes

Versions: 1

Compression:

Stored size: 807 Bytes

Contents

require "spec_helper"

require "hamster/experimental/mutable_set"

describe Hamster::MutableSet do

  describe "#add?" do

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

    describe "with a unique value" do

      before do
        @result = @set.add?("D")
      end

      it "returns true" do
        @result.should == true
      end

      it "modifies the set to include the new value" do
        @set.should == Hamster.mutable_set("A", "B", "C", "D")
      end

    end

    describe "with a duplicate value" do

      before do
        @result = @set.add?("C")
      end

      it "preserves the original values" do
        @set.should == Hamster.mutable_set("A", "B", "C")
      end

      it "returns false" do
        @result.should == false
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hamster-1.0.1.pre.rc.1 spec/hamster/experimental/mutable_set/add_qm_spec.rb