Home arrow Ruby-on-Rails arrow Page 2 - Forum Implementation: Viewing Posts
RUBY-ON-RAILS

Forum Implementation: Viewing Posts


In this third part of a four-part series on setting up a forum for an online bookstore using Ruby on Rails, we pick up where we left off; we'll also start setting up the sections that allow visitors to view forum posts. This article is excerpted from chapter six of the book Practical Rails Projects, written by Eldon Alameda (Apress; ISBN: 1590597818).

Author Info:
By: Apress Publishing
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
May 24, 2010
TABLE OF CONTENTS:
  1. · Forum Implementation: Viewing Posts
  2. · Testing
  3. · Implementing the View Forum User Story
  4. · Modifying the View

print this article
SEARCH DEVARTICLES

Forum Implementation: Viewing Posts - Testing
(Page 2 of 4 )

 

Let's run the integration test and verify that our user story is functioning as specified:

$ ruby test/integration/forum_test.rb

--------------------------------------------
Loaded suite test/integration/forum_test Started
.
Finished in 0.114117 seconds.

1 tests, 5 assertions, 0 failures, 0 errors
--------------------------------------------

If you followed our instructions, the test should pass without errors.

If you want, you can try a manual test as well. Manual testing is an important complement to automated tests and also makes development more fun, as you can see what you are building. Open http://localhost:3000/forum/post in your browser. Enter your name, the subject, and the body of the post in the form. Figure 6-2 shows our validation at work: an error message appears because we tried to post a message without entering any data into the fields.


Figure 6-2.  The create post page showing some validation errors

When you click the Post button, and if the data you entered passes validation, you're redirected to http://localhost:3000/forum . The page displays the message Forum#index , as we have not yet implemented the View Forum user story.


Note  Here, we showed you how to implement a test that verifies that a valid post is created successfully. It would be a good idea to also create tests for other scenarios, such as when data fails validation.



blog comments powered by Disqus
RUBY-ON-RAILS ARTICLES

- Ruby-on-Rails Faces Second Security Flaw in ...
- Ruby 2.0 Prepped for February 2013 Release
- Why LinkedIn Switched from Ruby on Rails
- Adding Style with Action Pack
- Handling HTML in Templates with Action Pack
- Filters, Controllers and Helpers in Action P...
- Action Pack and Controller Filters
- Action Pack Categories and Events
- Logging Out, Events and Templates with Actio...
- Action Pack Sessions and Architecture
- More on Action Pack Partial Templates
- Action Pack Partial Templates
- Displaying Error Messages with the Action Pa...
- Action Pack Request Parameters
- Creating an Action Pack Registration Form

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials