On 22 June 2012 15:07, Gurdipe Dosanjh <rhomobilea...@gmail.com> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to