Displaying 1 result from an estimated 1 matches for "image_numb".
Did you mean:
image_number
2007 Aug 23
6
controller spec with model that validates_uniqueness
...getting my validation not to trigger. Here''s the code:
# spec:
Image.stub!(:find).and_return(@image)
@image.should_receive(:save!).once.with(:any_args)
put :update, :id => @image.id, :category_id =>
@category.id, :image => {:name => ''test'', :image_number => 13554}
#model
validates_presence_of :name
validates_uniqueness_of :name, :allow_nil => true
# rspec output
ActiveRecord::RecordInvalid in ''ImagesController should update a
database record when it receives a PUT''
Validation failed: Name has already been taken...