On 22 June 2012 15:07, Gurdipe Dosanjh wrote:
What is the best way to unit test hard coded sql in a rails application.
You don't test SQL, you test methods. Whether the method gets it's
results through ActiveRecord, raw SQL, or fairies rummaging around the
hard drive, it's irrelevant to the tests. They should just be testing
that the expected values are returned by the method.

So the answer to your question may be "move the SQL to be wrapped by
methods, and test those", but without seeing some source code it would
be hard to say.

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
grouprubyonrails-talk @
postedJun 22, '12 at 2:07p
activeJun 22, '12 at 2:20p



site design / logo © 2021 Grokbase