Opened from disk

This site is meant to be served, so its folder tree and search do not work when a page is opened from disk. Run ghg serve in the folder of your ghg.toml, or serve the site's folder with any web server, then open the address it gives.

Skip to content
Theme

Feature: Borrowing books

Members of the library borrow books and take them home.
Each member may hold a few books at a time, for a few weeks each.

A book on the shelf can be borrowed at once.

  1. Given a member named "Ana" with card number 1024
  2. And the library is open

From the scenario

  1. Given the book "The Hobbit" is on the shelf
  2. When "Ana" borrows "The Hobbit"
  3. Then "The Hobbit" is due back in 21 days
  4. And "Ana" holds 1 book

  1. Given a member named "Ana" with card number 1024
  2. And the library is open

From the scenario

  1. Given these books are on the shelf:
    titleauthor
    MiddlemarchGeorge Eliot
    Dom CasmurroMachado de Assis
    Either | OrSøren Kierkegaard
  2. When "Ana" borrows every book on the shelf
  3. Then "Ana" holds 3 books

  1. Given a member named "Ana" with card number 1024
  2. And the library is open

From the scenario

  1. Given "<title>" is on the shelf
  2. When "Ana" borrows "<title>"
  3. Then "<title>" is due back in <days> days

Runs once for each row of these examples:

The limit keeps books on the shelves for everyone.

  1. Given a member named "Ana" with card number 1024
  2. And the library is open

  1. Given "Ana" holds 5 books

From the scenario

  1. Given the book "Emma" is on the shelf
  2. When "Ana" borrows "Emma"
  3. Then the loan is refused with "You already hold 5 books."
  4. And "Ana" holds 5 books

  1. Given a member named "Ana" with card number 1024
  2. And the library is open

  1. Given "Ana" holds 5 books

From the scenario

  1. Given "Ana" returns "The Hobbit"
  2. And the book "Emma" is on the shelf
  3. When "Ana" borrows "Emma"
  4. Then "Ana" holds 5 books

  1. Given a member named "Ana" with card number 1024
  2. And the library is open

From the scenario

  1. Given "Bea" asked to hold "Emma"
  2. And the book "Emma" is on the shelf
  3. When "Ana" borrows "Emma"
  4. Then the loan is refused with "Emma is on hold for another member."