# Rspec

**URL:** <https://www.ruby-forum.com/t/rspec/166143>\
**Category:** Rails\
**Created:** [April 22, 2009, 9:03am UTC](https://www.ruby-forum.com/t/rspec/166143 "2009-04-22T09:03:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shakthi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@shakthi](https://www.ruby-forum.com/u/shakthi)\
**Post date:** [April 22, 2009, 9:03am UTC](https://www.ruby-forum.com/t/rspec/166143/1 "2009-04-22T09:03:43Z")

</div>

How i can write spec for already existing model??? i need to write the  
test cases for already existing model…

---

<div class="post-metadata">

**Author:** ![shakthi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@shakthi](https://www.ruby-forum.com/u/shakthi)\
**Post date:** [April 22, 2009, 10:22am UTC](https://www.ruby-forum.com/t/rspec/166143/2 "2009-04-22T10:22:53Z")

</div>

On Wed, Apr 22, 2009 at 9:03 AM, Shakthi M.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How i can write spec for already existing model??? i need to write the  
> test cases for already existing model…

The same way you would for a model you don’t have.

Look at the model, and identify all that it does, then write tests to  
ensure that does all you assume it to do (and not do)

Andrew T.  
[http://ramblingsonrails.com](http://ramblingsonrails.com)  
[http://www.linkedin.com/in/andrewtimberlake](http://www.linkedin.com/in/andrewtimberlake)

“I have never let my schooling interfere with my education” - Mark Twain
