I have a simple model called “Section” with integration tests that
pass. However, when I add a simple validation to the model
(validates_presence_of :name) the integration test fails. This makes
no sense to me because I am passing in a name.
Does anyone know why that validation breaks my integration test?
class SectionsTest < ActionController::IntegrationTest
#Navigate to new Section form
#Submit new Section form with params post '/sections/create', :name => sections(:Home).name assert_response :redirect follow_redirect! #Test that Section was created successfully and user was
redirected to show page
assert_equal ‘Section was successfully created.’, flash[:notice]
class Section < ActiveRecord::Base
validates_presence_of :name #Adding this line causes the integration
test above fail
self.created_by = 1
self.modified_by = 2
Thanks for any help you can provide!