We Eatt


API Documentation

Api Recipe Detail

Feature: /api/v1/recipes/detail

	As an API User
	I want to get the detail for a recipe
	So that I can find cool stuff to cook

	Background: 
		Given I am a We Eatt chef
		And my "Content-Type" header is set to "application/json
		And my "Accept" header is set to "application/json"
		And my application api-key is set in the "x-api-key" header"

	Scenario: Detail Page
		Given a "public" recipe exists with permalink:"crock-pot-sweet-and-sour"
		When I send a GET request to "/api/v1/recipes/crock-pot-sweet-and-sour?auth_token=[@chef.auth_token]"
		Then the response status should be "200"
		And the response should be a JSON "Recipe" object:
		"""
		{
			"id": 656,
			"permalink": "crock-pot-sweet-and-sour",
			"name": "Crock Pot Sweet and Sour ",
			"ingredients": "1 pound chicken (or other meat)\r\n1/2 green pepper\r\n1/2 red pepper\r\n1 cup fresh broccoli\r\n1/2 red onion\r\n1/4 teaspoon onion powder\r\n1/4 teaspoon garlic powder\r\n1 can pineapple tidbits (8 ounce)\r\n1 tablespoon brown sugar\r\n1/2 bottle sweet and sour sauce\r\n1 cup prepared rice",
			"instructions": "Cut meat into bite sized pieces.  Place in crock pot with onion powder and garlic powder.  Stir.   Drain pineapple, saving juice.   Add brown sugar, sweet and sour sauce, pineapple tidbits and 1/2 of the pineapple juice to crock pot.  Cook on high for a few hours stirring occasionally.   Chop vegetables into large pieces and add to crock pot with remaining pineapple juice, cook for 1/2 hour longer.  Serve over rice.",
			"description": "Super easy knock off of Chinese take out!",
			"chef": {
					"id": 604,
					"name": "Jen Kahler",
					"login": "jkahler",
					"large_avatar_path": "/system/avatars/149/large/200707-208125_0379_900.jpg?1299698086",
					"thumbnail_avatar_path": "/system/avatars/149/thumb/200707-208125_0379_900.jpg?1299698086"
			},
			"images": [
					{
							"id": 653,
							"large_image_path": "/photos/large/missing.png",
							"thumbnail_path": "/photos/thumbnail/missing.png"
					}
			],
			"videos": [
					
			]
		}
		"""		
	Scenario: Incorrect or Deleted Recipe
		When I send a GET request to "/api/v1/recipes/deleted_recipe?auth_token=[@chef.auth_token]"
		Then the response status should be "404"

	Scenario: Private Recipe Without Access
		Given a "private" recipe exists with permalink:"you-want-it-but-cant-haveit"
		When I send a GET request to "/api/v1/recipes/you-want-it-but-cant-haveit?auth_token=[@chef.auth_token]"
		Then the response status should be "403"