Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Standup 10/2/2008: rspec running describes in order

Interesting Things

  • Rspec – stubbing a class method

In Rspec you can stub a class method in a module using Module::Class:Stubs(’method’) similar to Mocha syntax
stub! does not work for Module::Class:method in rspec

  • Rspec – running test in order

If someone knows of a way to run describes in order in rspec test, please let me know

Ask for Help

“Finder conditions in rails?”

    find(:all, :conditions => 'flag is null')  where flag is boolean

This would work in tests but not in development mode. They tried changing it to

    find(:all, :conditions => 'flag != 1')  where flag is boolean

and this would work in dev mode but not in test.

Try having boolean values in database as not null and never pass null to boolean.
Make sure fixtures and development data have similar data sets.

“Selenium tests failing to load associations”

Check if you RAILS_ENV is set to test while running Selenium. There has been some cases of weird rails behavior running tests when RAILS_ENV is set to development

  1. Jeff Dean says:

    How about:

    find(:all, :conditions => [‘flag != ?’, true])

  2. Joseph Palermo says:

    That generates

    WHERE (flag != 1)

    which still won’t find you NULL values, you need

    WHERE flag IS NULL OR flag = 0

    but it probably make more sense to just make your column `:null => false` and ensure you only have 0’s in there.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *