Will, Mislav, thanks for all your help!

I've used subscriber to implement my assert_no_database helper. When
asserted block of code performs any SQL requests, these requests are
included into test output: https://gist.github.com/1305807

 Thanks again!
 KIR



On 17 October 2011 04:54, Will Bryant <[email protected]> wrote:

> On 17/10/2011, at 08:08 , KIR wrote:
>
> >
> >     Thanks a lot for the hint, will investigate it.
> >     May be, I'll be able to rewrite my assert_no_database assertion using
> its approach.
>
> There's assert_queries/assert_no_queries in the test case support code,
> which sound quite similar to what you want.  But it needs a subscriber
> implementation (such as Mislav was talking about for will_paginate), which
> you need to feed into the global variable that the assertions check.
>
> Rails has a subscriber implementation for its own tests, but it isn't
> exposed.  IMHO it would be great it did, so we could just instantiate that
> in app test code without having to copy it in (it's somewhat
> version-specific).
>
> Have a look at activerecord/test/cases/helper.rb to see how it works.  The
> assertions that use it are defined in
> activerecord/lib/active_record/test_case.rb, so they are exposed, which
> doesn't make much sense at the moment.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-core?hl=en.
>
>


-- 

Kirill (KIR) Maximov

Software Engineer & Starter


Twitter:       http://twitter.com/maxkir

Skype:        maxkir

http://kirblog.idetalk.com | http://checkvist.com |
http://www.jetbrains.com/teamcity

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to