This project is archived and is in readonly mode.
Make assert_sql output easier to debug the problem
Reported by Emilio Tagua | April 27th, 2009 @ 09:31 PM | in 2.x
This is a small improvement to assert_sql, making the it's output easier to debug the problem.
Fox example for this failing test:
def test_merged_scoped_find
poor_jamis = developers(:poor_jamis)
Developer.with_scope(:find => { :conditions => "salary < 100000" }) do
Developer.with_scope(:find => { :offset => 1, :order => 'id asc' }) do
assert_sql /ORDER BY id asc / do
assert_equal(poor_jamis, Developer.find(:first, :order => 'id asc'))
end
end
end
end
Instead of the current output:
Query pattern(s) /ORDER BY id asc / not found.
You'll get something like this:
Query pattern(s) /ORDER BY id asc / not found in SELECT * FROM `developers` WHERE (salary < 100000) ORDER BY id asc LIMIT 1, 1.
Showing the executed queries and making easier to figure put why it isn't the expected result.
Comments and changes to this ticket
-
Repository April 28th, 2009 @ 10:13 PM
- State changed from new to resolved
(from [4246a79a991af6c4c5a9473d01e805a5ac04624a]) Show executed queries when assert_sql assertion fails [#2573 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 2573 Make assert_sql output easier to debug the problem (from [4246a79a991af6c4c5a9473d01e805a5ac04624a]) Show ex...