Sha256: 22cc5a8353bdfc6511197e304db3b4f3759cf6e8923e6b0e484c8c9bf42d5a60

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require "spec_helper"

describe Rico::List do
  before :each do
    RiakHelpers.reset!
  end

  describe "#add" do
    it "adds values and sorts them in instance" do
      a = Rico::List.new RiakHelpers.bucket, "list_add_1"
      a.add(3, 2, 1)
      a.members.should eql [1, 2, 3]
    end

    it "adds values and sorts them on read" do
      a = Rico::List.new RiakHelpers.bucket, "list_add_2"
      a.add(3, 2, 1)
      b = Rico::List.new RiakHelpers.bucket, "list_add_2"
      b.members.should eql [1, 2, 3]
    end

    it "allows duplicates of the same value" do
      a = Rico::List.new RiakHelpers.bucket, "list_add_duplicate"
      a.add(3, 6, 4, 1, 7, 9, 1, 1, 3, 3)
      b = Rico::List.new RiakHelpers.bucket, "list_add_duplicate"
      b.members.should eql [1, 1, 1, 3, 3, 3, 4, 6, 7, 9]
    end
  end

  describe "#remove" do
    it "removes all occurence of the item" do
      a = Rico::List.new RiakHelpers.bucket, "list_remove_all_duplicates"
      a.add(1, 1, 1, 2, 2, 2)
      b = Rico::List.new RiakHelpers.bucket, "list_remove_all_duplicates"
      b.remove(1, 2)
      c = Rico::List.new RiakHelpers.bucket, "list_remove_all_duplicates"
      c.members.should eql []
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rico-0.3.0 spec/list_spec.rb
rico-0.2.0 spec/list_spec.rb
rico-0.1.0 spec/list_spec.rb
rico-0.0.1 spec/list_spec.rb