Testing find_by_sql

Hi all,

I have a controller method that, given some parameters, constructs a big
sql query and passes it to find_by_sql (with pagination).

The point is that I can’t wonder how to write a functional test for this
method. Has anyone passed already through this?

The point is that I can’t wonder how to write a functional test for this
method. Has anyone passed already through this?

create lots of fixtures that contain all possible cases
make get/post calls with all possible parameters (and combinations of
parameters)
check if your find_by_sql results are what you expect

just the same as in a ‘normal’ action with find or find_all_by_…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs