On 8/27/07, Courtenay <court3nay at gmail.com>
wrote:> You create the records.
I guess that I need to hit the database to really test if the method
is working at all.
In fact what I must test is the SQL query itself.
Thanks.
>
> @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
> >
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users