-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
15 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
require 'test_helper' | ||
|
||
# class RecipesControllerTest < ActionController::TestCase | ||
class RecipesControllerTest < ActionDispatch::IntegrationTest | ||
setup do | ||
@user = User.new(username: "MYSTRING", email: "[email protected]", admin: true) | ||
|
@@ -31,18 +30,35 @@ class RecipesControllerTest < ActionDispatch::IntegrationTest | |
|
||
test "should update recipe" do | ||
sign_in @user | ||
@recipe = recipes(:one) | ||
|
||
patch recipe_url(@recipe), recipe: { | ||
name: "This is a name", | ||
summary: @recipe.summary, | ||
description: @recipe.description, | ||
prep_times: @recipe.prep_times, | ||
servings_made: @recipe.servings_made, | ||
feeds: 3, | ||
user_id: 1, | ||
calories: 15 | ||
} | ||
@recipe = recipes(:one) | ||
patch recipe_url(@recipe), recipe: { | ||
name: "This is a name", | ||
summary: @recipe.summary, | ||
description: @recipe.description, | ||
prep_times: @recipe.prep_times, | ||
servings_made: @recipe.servings_made, | ||
feeds: 3, | ||
user_id: 1, | ||
calories: 15 | ||
} | ||
assert_redirected_to recipe_url(@recipe) | ||
end | ||
|
||
test "should create recipe" do | ||
sign_in @user | ||
@recipe = recipes(:one) | ||
assert_difference('Recipe.count') do | ||
post recipes_url, recipe: { | ||
name: "This is a name", | ||
summary: @recipe.summary, | ||
description: @recipe.description, | ||
prep_times: @recipe.prep_times, | ||
servings_made: @recipe.servings_made, | ||
feeds: 3, | ||
user_id: 1, | ||
calories: 15 | ||
} | ||
end | ||
assert_redirected_to recipes_path | ||
end | ||
end |