[rspec-users] Model validation failing in rspec for unknown reason

The Ultimation lists at ruby-forum.com
Tue Feb 8 12:25:30 EST 2011

Hi, i'm getting the following error when running a spec on my controller
for my Equipment model.

    it "edit action should render edit template" do
      get :edit, :id => Factory(:equipment)
      response.should render_template(:edit)

     Failure/Error: get :edit, :id => Factory(:equipment)
       Validation failed:

The test is very simple, it builds an Equipment factory and tests to see
if the edit template loads. This test works for every other model, and I
tried removing all validations from this model but still no luck.
Everything works on the webpage, just not in this test. I even created
the factory successfully in command line without error. I'm just stumped
as to what's going on. When i use --backtrace, it doesn't really shed
any light either. It's just not saving because of an unknown validation

The only thing I can think of that might be causing an issue is an
inflection that i use for this model. Here it is:

ActiveSupport::Inflector.inflections do |inflect|
  inflect.irregular 'equipment', 'equipments'

Any help would be greatly appreciated. Thanks!

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list