Created
May 24, 2010 20:54
-
-
Save softcraft-development/412413 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_update_nested | |
ingredient = Factory.create(:ingredient) | |
put :update, | |
:id=>ingredient.recipe.friendly_id, | |
:recipe=> { | |
:name=> ingredient.recipe.name, | |
:ingredients_attributes=>{ | |
"0"=>{ | |
:name=>ingredient.name, | |
:amount=>ingredient.amount, | |
:"id"=>ingredient.id, | |
:_destroy=>"1" | |
} | |
} | |
} | |
recipe = Recipe.find(ingredient.recipe.id) | |
assert_equal 0, recipe.ingredients.size | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment