docker-compose up -d
# create and migrate database
docker-compose run --rm web rake db:create db:migrate
If user is not existed, auto signup and signin
curl --request POST \
--url http://localhost:3000/api/users/sign_in \
--header 'Content-Type: application/json' \
--data '{
"user": {
"email": "test@example.com",
"password": "password"
}
}'
# Sample response. Copy the token value to make an authorization for each request
{
"user": {
"id": 2,
"email": "test@example.com",
"token": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MiwiZXhwIjoxNjQ1MDAxNDYxfQ.r_CH4BvjKhdxM1UQscUJ17T7x5_rs1nPGgjD42-eK8g"
}
}
curl --request POST \
--url http://localhost:3000/api/tasks \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MiwiZXhwIjoxNjQ1MDAxNDYxfQ.r_CH4BvjKhdxM1UQscUJ17T7x5_rs1nPGgjD42-eK8g' \
--header 'Content-Type: application/json' \
--data '{
"task": {
"title":"Test task title",
"description":"Test task description"
}
}'
docker-compose run web bundle exec rspec test spec/models/
docker-compose run web bundle exec rspec test spec/requests/