[rspec-users] thanks......but more question

Andy Lindeman alindeman at gmail.com
Mon Aug 13 11:51:45 UTC 2012

On Mon, Aug 13, 2012 at 12:55 AM, Fahim Patel <pafahim at gmail.com> wrote:
> 1. model spec only consist a spec of validation only????? or we can write
> more different type of spec in it.....

RSpec places no restrictions on what types of tests you write in your
model specs. I've seen tests against validations, but also against
other logic that is in the model.

> 2. please tell me that or give category that  what kind of spec is expecting
> in Model spec,controller spec ,view spec ,request,helper,
> (spec directory structure) ....

Model specs test models; controller tests test controllers; view tests
test views; helper specs test helpers. These are ideally all unit
tests that take one object and test it in isolation or near isolation;
however, there's nothing in RSpec that restricts you to that either.

Request specs are meant to be full-stack or close to full-stack tests
that interact with the application via HTTP requests. These requests
run through the entire system and you usually assert either against
the state afterward (e.g., I expect this request to create a user in
the database) or against the state a client could observe (e.g., I
expect this request to return an HTML table of users).

Andy Lindeman

More information about the rspec-users mailing list