Database Articles

  Home arrow Database Articles arrow User Stories for a Book Inventory Mana...
DATABASE ARTICLES

User Stories for a Book Inventory Management System
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating:  stars stars stars stars stars / 0
    2011-11-09

    Table of Contents:
  • User Stories for a Book Inventory Management System
  • Integration Testing

  •  
     

    SEARCH CODEWALKERS

    User Stories for a Book Inventory Management System


    (Page 1 of 2 )

    In this eighth part of a twelve-part series on the scaffolding feature of Ruby on Rails, we'll start implementing the front end of our book inventory management system. This article is excerpted from chapter three of the book Practical Rails Projects, written by Eldon Alameda (Apress; ISBN: 1590597818).

    Generating Book Administration Code with the Scaffolding Script

    With both the database schema and ActiveRecord model in place, we are now ready to start implementing the front-end. The requirements for book administration include five user stories: Add Book, Upload Book Cover, View Book, Edit Book, and Delete Book.


    Tip It’s good practice to run all your tests—including unit, integration, and functional—after you make any big changes, as we have done in this chapter. This can be done by running therakecommand without specifying any parameters. However, at this point, it will throw an error. You can fix this by adding the lineconfig.active_record.schema_format = :sqltoconfig/environment.rb.


    As with the publisher administration interface, we use scaffolding to create the controller, model, and view files by executing thegeneratescript:

    $ script/generate scaffold Book 'admin/book'

    exists app/controllers/admin
    exists app/helpers/admin
    create app/views/admin/book
    exists test/functional/admin
    dependency model
    exists app/models/
    exists test/unit/
    exists test/fixtures/
    skip app/models/book.rb
    skip test/unit/book_test.rb
    skip test/fixtures/books.yml
    create app/views/admin/book/_form.rhtml
    create app/views/admin/book/list.rhtml
    create app/views/admin/book/show.rhtml
    create app/views/admin/book/new.rhtml
    create app/views/admin/book/edit.rhtml
    create app/controllers/admin/book_controller.rb
    create test/functional/admin/book_controller_test.rb
    create app/helpers/admin/book_helper.rb
    create app/views/layouts/book.rhtml
    create public/stylesheets/scaffold.css

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    You can delete thepublic/stylesheets/scaffold.cssfile, because you already have a style sheet. Note that the generated functional test will fail if you execute it. You can decide whether to keep it or

    You can delete the public/stylesheets/scaffold.css file, because you already have a style sheet. Note that the generated functional test will fail if you execute it. You can decide whether to keep it or delete it, but we deleted it by executing the following command:

    $ rm test/functional/admin/book_controller_test.rb

    Now we’ll introduce you to integration tests, which we’ll use to test the front-end instead of functional tests.

    More Database Articles Articles
    More By Apress Publishing

    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - MariaDB, a MySQL Alternative, Opens Foundati...
    - Oracle Supporting HP Itanium Again, Finally
    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual

    Developer Shed Affiliates

     



    © 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap