indiamos / learnwitch

Bookmarking meets GTD?

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TEST: Write api tests for Newt and Tag

indiamos opened this issue · comments

commented

As a developer, I want tests to make sure that the following operations work, so I can tell when I break something:

Create

  • Newt records can be added to the database
  • Tag records can be added to the database
  • Newt and Tag records can be associated with each other, through the table newt_tag
  • identical (case insensitive) tags cannot be created

Read

  • all Newts having a particular Tag can be retrieved
  • all Tags belonging to a particular Newt can be retrieved

Update

  • a Newt can be revised
  • when a Tag is deleted from a Newt, the related newt_tag row is also deleted
  • when a Tag is deleted from a Newt, any Tags orphaned by the deletion are also deleted
  • a Tag can be renamed

Destroy

  • when a Newt is deleted, all related newt_tag rows are also deleted
  • when a Newt is deleted, any Tags orphaned by the deletion are also deleted