Sha256: b8769ea60cd6dc189edd6ad9541193237831a7c7f9b7db54aadd71155b3a20c4

Contents?: true

Size: 871 Bytes

Versions: 2

Compression:

Stored size: 871 Bytes

Contents

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

require 'hamster/set'

describe Hamster::Set do

  describe "#delete" do

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

    describe "with an existing value" do

      before do
        @result = @original.delete("B")
      end

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

      it "returns a copy with the remaining of values" do
        @result.should == Hamster.set("A", "C")
      end

    end

    describe "with a non-existing value" do

      before do
        @result = @original.delete("D")
      end

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

      it "returns self" do
        @result.should equal(@original)
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hamster-0.2.7 spec/hamster/set/delete_spec.rb
hamster-0.2.6 spec/hamster/set/delete_spec.rb