Home arrow Ruby-on-Rails arrow Page 3 - Basic Tests for Forum Implementation

Basic Tests for Forum Implementation

In this second part of a four-part series on setting up a forum in Ruby on Rails, you'll learn how to unit test a model, generate a forum controller and view, and more. 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 / 1
May 21, 2010
  1. · Basic Tests for Forum Implementation
  2. · Generating the Controller and View
  3. · Implementing the User Stories
  4. · Creating the Integration Test

print this article

Basic Tests for Forum Implementation - Implementing the User Stories
(Page 3 of 4 )

As in previous chapters, we will show you how to use the TDD approach while implementing the forum. This means that you will first create the unit tests, or in this chapter, integration tests. In Chapter 3, we introduced integration testing and mentioned some of the benefits of using integration tests, including multiple session support and tests that span multiple controllers. A forum can be accessed by many users at the same time, which makes it a good candidate for integration testing. For example, George might be replying to a post at the same time as Jill is creating a new post. Integration tests make it possible to simulate this by allowing us to open multiple sessions in the test and execute each action in a different session.

The forum needs some posts for the other user stories to make any sense, so we'll start by implementing the Post to Forum user story.

Implementing the Post to Forum User Story

The Post to Forum user story describes how a customer, or George himself, submits a new post to the forum. This is done by filling out the required information, including the name of the person creating the post, plus the subject and body of the post. To publish the post to the forum, the user should click the Post button. This saves the post in the database and redirects the user to the main page of the forum, where he can see the post at the top of the page. 

blog comments powered by Disqus

- 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 

Developer Shed Affiliates


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