Hi What is the best way to unit test hard coded sql in a rails application. Gurdipe
on 2012-06-22 16:08
on 2012-06-22 16:23
On 22 June 2012 15:07, Gurdipe Dosanjh <rhomobileapps@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.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.