We Eatt


API Documentation

Api New Users

Feature: /api/v1/sign_up

	As an API User
	I want to sign up with We Eatt
	So that I can retrieve my auth_token
	And make further requests

	Background:
		Given I have a We Eatt account with login: "chefczar", email: "chefczar@weeatt.com", password: "supersecret"
		And my "Accept" header is set to "application/json"
		And my "Content-Type" header is set to "application/json"
		And my application api-key is set in the "x-api-key" header

	Scenario: Create with all information required
		When I post the following JSON to "/api/v1/chefs":
		"""
		{
			"chef":{
				"login":"new_api_user",
				"email":"new_api_user@noweeatt.com",
				"password":"SupaSecret2011",
				"password_confirmation":"SupaSecret2011"
			}	
		}
		"""
		Then the response should be the JSON:
		"""
		{		
				"id": 95345,
				"name": "new_api_user",
				"login": "new_api_user@noweeatt.com",
				"large_avatar_path": null,
				"thumbnail_avatar_path": null,
				"auth_token": "oOWMxgwFlnv1F2xvWTGQ",
				"email": "new-api_user@noweearr.com"
		}

		"""
	Scenario: Errors exist in the creation
		Given a user exists with the login "jworules"
		When I post the following JSON to "/api/v1/chefs":
		"""
		{
			"chef":{
				"login":"jworules",
				"email":"jworules@example.com",
				"password":"SupaSecret2011",
				"password_confirmation":"SupaSecret2011" 
			}	
		}
		"""	
		Then the response should be the JSON:
		"""
		{
			"email":["has already been taken"],
			"login":["has already been taken"]
		}
		"""