Closed Ritarira closed 6 years ago
Test plan:
:white_check_mark: Check if I can see the author's name when I request a list of books GET localhost:3000/books Status 200
[
{
"id": 10,
"author_id": 7,
"title": "Wait for you",
"description": "Love isn't meant to be perfect... Except when it is",
"created_at": "2017-12-07T07:51:51.868Z",
"updated_at": "2017-12-13T08:24:33.098Z",
"rating": 6,
"author": {
"first_name": "J",
"last_name": "Lynn"
}
},
{
"id": 16,
"author_id": 10,
"title": "Cars",
"description": "A new novel about risking everything for love",
"created_at": "2017-12-12T12:19:03.858Z",
"updated_at": "2017-12-12T12:19:03.858Z",
"rating": 10,
"author": {
"first_name": "Katie",
"last_name": "McGarry"
}
},
{
"id": 17,
"author_id": 10,
"title": "Beautiful Disaster",
"description": "The new Abby Abernathy is a good girl. She doesn’t drink or swear, and she has the appropriate percentage of cardigans in her wardrobe. Abby believes she has enough distance between her and the darkness of her past, but when she arrives at college with her best friend America, her path to a new beginning is quickly challenged by Eastern University’s Walking One-Night Stand. Travis Maddox, lean, cut, and covered in tattoos, is exactly what Abby needs—and wants—to avoid. He spends his nights winning money in a floating fight ring, and his days as the charming college co-ed. Intrigued by Abby’s resistance to his charms, Travis tricks her into his daily life with a simple bet. If he loses, he must remain abstinent for a month. If Abby loses, she must live in Travis’ apartment for the same amount of time. Either way, Travis has no idea that he has met his match.",
"created_at": "2017-12-13T08:28:54.872Z",
"updated_at": "2017-12-13T08:28:54.872Z",
"rating": 9,
"author": {
"first_name": "Katie",
"last_name": "McGarry"
}
}
]
:white_check_mark: Check if I can see the author's name when I request a single book GET localhost:3000/books/16 Status 200
{
"id": 16,
"author_id": 10,
"title": "Cars",
"description": "A new novel about risking everything for love",
"created_at": "2017-12-12T12:19:03.858Z",
"updated_at": "2017-12-12T12:19:03.858Z",
"rating": 10,
"author": {
"first_name": "Katie",
"last_name": "McGarry"
}
}
:white_check_mark: Check if I can create a new book that will have an author's name shown Request: POST localhost:3000/books
{
"author_id": 7,
"title": "Trust in me",
"description": "Traveling thousands of miles from home to enter college is the only way nineteen-year-old Avery Morgansten can escape what happened at the Halloween party five years ago—an event that forever changed her life. All she needs to do is make it to her classes on time, make sure the bracelet on her left wrist stays in place, not draw any attention to herself, and maybe—please God—make a few friends, because surely that would be a nice change of pace. The one thing she didn’t need and never planned on was capturing the attention of the one guy who could shatter the precarious future she’s building for herself."
}
Response: Status 201
{
"id": 19,
"author_id": 7,
"title": "Trust in me",
"description": "Traveling thousands of miles from home to enter college is the only way nineteen-year-old Avery Morgansten can escape what happened at the Halloween party five years ago—an event that forever changed her life. All she needs to do is make it to her classes on time, make sure the bracelet on her left wrist stays in place, not draw any attention to herself, and maybe—please God—make a few friends, because surely that would be a nice change of pace. The one thing she didn’t need and never planned on was capturing the attention of the one guy who could shatter the precarious future she’s building for herself.",
"created_at": "2017-12-14T07:42:50.096Z",
"updated_at": "2017-12-14T07:42:50.096Z",
"rating": 0
}
Request: GET localhost:3000/books/19
Response: Status 200
{
"id": 19,
"author_id": 7,
"title": "Trust in me",
"description": "Traveling thousands of miles from home to enter college is the only way nineteen-year-old Avery Morgansten can escape what happened at the Halloween party five years ago—an event that forever changed her life. All she needs to do is make it to her classes on time, make sure the bracelet on her left wrist stays in place, not draw any attention to herself, and maybe—please God—make a few friends, because surely that would be a nice change of pace. The one thing she didn’t need and never planned on was capturing the attention of the one guy who could shatter the precarious future she’s building for herself.",
"created_at": "2017-12-14T07:42:50.096Z",
"updated_at": "2017-12-14T07:42:50.096Z",
"rating": 0,
"author": {
"first_name": "J",
"last_name": "Lynn"
}
}
:white_check_mark: Check if I can see the author's name when I request a book with author that just has been created Request: POST localhost:3000/authors
{
"first_name": "Colleen",
"last_name": "Hoover"
}
Response: Status 201
{
"id": 14,
"first_name": "Colleen",
"last_name": "Hoover",
"created_at": "2017-12-14T07:32:10.282Z",
"updated_at": "2017-12-14T07:32:10.282Z"
}
Request: POST localhost:3000/books
{
"author_id": 14,
"title": "Maybe someday",
"description": "Sydney is living in an idyllic bubble—she's a dedicated student with a steady job on the side. She lives with her best friend, has a great boyfriend, and the music coming from the balcony opposite hers is fast becoming the soundtrack to her life. But when Sydney finds out her boyfriend is cheating on her, the bubble bursts. The mysterious and attractive man behind the music, Ridge, gives Sydney hope that she can move on and they begin to write songs together. But moving on is harder than she expects, Sydney can only hope…. ",
"rating": 10
}
Response: Status 201
{
"id": 20,
"author_id": 14,
"title": "Maybe someday",
"description": "Sydney is living in an idyllic bubble—she's a dedicated student with a steady job on the side. She lives with her best friend, has a great boyfriend, and the music coming from the balcony opposite hers is fast becoming the soundtrack to her life. But when Sydney finds out her boyfriend is cheating on her, the bubble bursts. The mysterious and attractive man behind the music, Ridge, gives Sydney hope that she can move on and they begin to write songs together. But moving on is harder than she expects, Sydney can only hope…. ",
"created_at": "2017-12-14T07:54:52.922Z",
"updated_at": "2017-12-14T07:54:52.922Z",
"rating": 10
}
Request: GET localhost:3000/books/20
Response: Status 200
{
"id": 20,
"author_id": 14,
"title": "Maybe someday",
"description": "Sydney is living in an idyllic bubble—she's a dedicated student with a steady job on the side. She lives with her best friend, has a great boyfriend, and the music coming from the balcony opposite hers is fast becoming the soundtrack to her life. But when Sydney finds out her boyfriend is cheating on her, the bubble bursts. The mysterious and attractive man behind the music, Ridge, gives Sydney hope that she can move on and they begin to write songs together. But moving on is harder than she expects, Sydney can only hope…. ",
"created_at": "2017-12-14T07:54:52.922Z",
"updated_at": "2017-12-14T07:54:52.922Z",
"rating": 10,
"author": {
"first_name": "Colleen",
"last_name": "Hoover"
}
}
:white_check_mark: Check status codes of all valid responses
User Story: As an API consumer, I want to see the name of the author both when requesting a list of books and a single book, So that I don't make extra requests to get info about the author.
Acceptance Criteria: