Hi Chris,

Some folks recommend not testing the "has_many" and "validates_presence_of"
stuff, since Rails has it all tested. But I would highly recommend making
sure you use all the Rspec helpers on each model to make sure they pass.

Like the helpers provided in: https://github.com/carlosbrando/remarkable

it { should validate_presence_of :name }


Those are quick and easy to add for each model.

Regards,
Adam



On Fri, Dec 13, 2013 at 10:55 PM, Chris McCann <[email protected]>wrote:

> SD Ruby,
>
> It's finally time for me to upgrade the first Rails app I ever built.
>  Thanks to all who made some great suggestions previously on approaches for
> doing so -- I'm well under way.
>
> One of the things I want to make right with the upgrade from Rails 2.3 to
> (initially) 3.1 is adding test coverage.  When I started this app over
> (gulp!) 6 1/2 years ago I was an utter noobie and didn't know jack squat
> about unit testing or any other kind of software testing.  So, the
> application doesn't have any test coverage.  Zero.  Zip.  Nada.
>
> I'm presently bringing all the models into the Rails 3 version of the app,
> checking gem and plugin dependencies, fixing fully deprecated method calls
> (I'm looking at you, "named_scope"!) and really just trying to get the app
> to start cleanly on the Rails console.
>
> I've decided I want to use RSpec to write all the tests and am enjoying
> getting up to speed on that test framework.
>
> The question I'm posing to the group is this:  what's a good approach to
> adding tests to existing Rails models using RSpec?  What should I be trying
> to cover?  Are there any tests that are particularly smart to run in a
> framework upgrade situation?  What types of tests would you add right off
> the bat?
>
> For now I'm only concerned about the models.  As I get more comfortable
> with the test coverage on them I'll begin bringing over the controllers and
> views.
>
> If you have any advice on an approach I might consider at this point I'd
> love to get some input.  It's never too late to add tests to an app, and
> I'd like to maximize the bang for the buck here.
>
> Cheers,
>
> Chris
>
> --
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
> ---
> You received this message because you are subscribed to the Google Groups
> "SD Ruby" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
--- 
You received this message because you are subscribed to the Google Groups "SD 
Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to