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