I'm testing an ActiveRecord model using rspec and mocha, and found that if I stub out the :valid? method, all before_validation callbacks are also skipped!
Not ideal - I still want the callbacks to execute, but the validation to return true. Anyone know how to achieve this? class Item < ActiveRecord::Base before_validation :do_something def do_something raise "hell" end end Item.any_instance.stubs(:valid?).returns(true) item = Item.new item.valid? -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users