Announcement (2017-05-07): www.ruby-forum.com is now read-only since I
unfortunately do not have the time to support and maintain the forum any
more. Please see rubyonrails.org/community and ruby-lang.org/en/community
for other Rails- und Ruby-related community platforms.

Hi,
I want to get into testing. I really do.
However I find it problematic to jump over testing when I know my rails
code is not perfect. I'm not a ror expert yet so most of my energy is
spent in development.
I have some questions:
- How easy/hard is to introduce rspec in the middle of development, I
think you have to generate scaffolds with that enable isn't it? But I
already have a base without them.
- Is rspec a good choice to start with, specially since focus in on
learning the framework and trying to implement the planned features?
Actually I have more questions but I don't know how to formulate them
:-P
I understand the importance of testing and I want to have it, just don't
know where to start, the testing framework, the framework with some
plugins, rspec, ...?
I would also appreciate some hints to make the process easier, for
example: start by testing your controllers only, then move to something
else later on, etc.
I'll be happy to hear from you guys.
Cheers.

> - How easy/hard is to introduce rspec in the middle of development, I> think you have to generate scaffolds with that enable isn't it? But I> already have a base without them.>
Sorry, can't help you there, since we implement testing from the
beginning.
Just setup an empty project and see, what files rspec generates.
They're just ruby code, so you can implement missing files where
necessary.
> - Is rspec a good choice to start with, specially since focus in on> learning the framework and trying to implement the planned features?>
We use rspec and are quite happy with it.
Learning it shouldn't be more difficult than learning the test
framework.
> I understand the importance of testing and I want to have it, just don't> know where to start, the testing framework, the framework with some> plugins, rspec, ...?>
I would recommend rspec
> I would also appreciate some hints to make the process easier, for> example: start by testing your controllers only, then move to something> else later on, etc.>
Yes, start with the controllers. They are the crucial point in your
app,
where I think the most errors happen.
Call every single action and make sure, that you get the expected
response,
that it renders the right thing or redirects to the right page.
Make sure, you get the right records and correct content in the
database
for all possible parameters.
Make sure, users have to be logged in and get redirected if they're
not.
Make sure, users can't access data of other users (Login as user A
and call a index or show function with the id of user B, make sure
that this
redirects or shows an empty page. Same goes (for example) for
making orders or payments by users.
Call form actions (create) with invalid data, make sure that generates
errors
and nothing goes into the database.
Next are the models. Test for working associations and validations.
Views are difficult to test, especially if you use Ajax.