[rspec-users] Testing arbitrary SQL

Courtenay court3nay at gmail.com
Mon Aug 27 14:48:23 EDT 2007


You create the records.

  @bah = Bah.create!
  [1, 5, 22, 16].each { |amount| Foo.create! :amount => amount, :bah => @bah }

  @bah.foos.should == 44


On 8/27/07, Rodrigo Alvarez Fernández <papipo at gmail.com> wrote:
> Hi,
>
> I would like to know how would you test a method in a model that uses
> complex a SQL query that joins several tables in order to make a
> calculation.
>
> I suppose that I need fixtures, although my approach with rspec is to
> avoid fixtures and isolate model specs, but none of both seems
> possible in this case. Is there another way than fixtures?
>
> Thanks.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list