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
How about:
find(:all, :conditions => ['flag != ?', true])
October 3, 2008 at 1:47 pm
That generates
which still won’t find you NULL values, you need
but it probably make more sense to just make your column `:null => false` and ensure you only have 0′s in there.
October 4, 2008 at 1:06 am