Sha256: 60ac0c4a9fe4503e523024cf7e5fc682cb085ba78c1148a1720d45cfc9c516a0

Contents?: true

Size: 673 Bytes

Versions: 18

Compression:

Stored size: 673 Bytes

Contents

require 'helper'

class SetTest < Test::Unit::TestCase
  def from_db
    Recipe.find(@recipe.id)
  end

  context "working with sets" do
    setup do
      @recipe = Recipe.create!(:ingredients => %w[salt sugar water salt sugar water])
    end

    should "not have duplicates" do
      from_db.ingredients.size.should == 3
      from_db.ingredients.should include("salt")
      from_db.ingredients.should include("sugar")
      from_db.ingredients.should include("water")
    end

    should "not add duplicates" do
      original_size = @recipe.ingredients.size
      @recipe.ingredients << "salt"
      @recipe.ingredients.size.should == original_size
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
mongoid_ext-0.6.1 test/types/test_set.rb
mongomapper_ext-0.5.2 test/types/test_set.rb
mongomapper_ext-0.5.1 test/types/test_set.rb
mongomapper_ext-0.5.0 test/types/test_set.rb
mongomapper_ext-0.4.0 test/types/test_set.rb
mongomapper_ext-0.3.0 test/types/test_set.rb
mongomapper_ext-0.2.4 test/types/test_set.rb
mongomapper_ext-0.2.3 test/types/test_set.rb
mongomapper_ext-0.2.2 test/types/test_set.rb
mongomapper_ext-0.2.1 test/types/test_set.rb
mongomapper_ext-0.2.0 test/types/test_set.rb
mongomapper_ext-0.1.5 test/types/test_set.rb
mongomapper_ext-0.1.4 test/types/test_set.rb
mongomapper_ext-0.1.3 test/types/test_set.rb
mongomapper_ext-0.1.2 test/types/test_set.rb
mongomapper_ext-0.1.1 test/types/test_set.rb
mongomapper_ext-0.1.0 test/types/test_set.rb
mongomapper_ext-0.0.4 test/types/test_set.rb