test/ceo/edit_apple_test.rb in ceo-0.1.5 vs test/ceo/edit_apple_test.rb in ceo-0.1.6

- old
+ new

@@ -24,6 +24,27 @@ new_apple = Apple.find(@apple.id).attributes refute_equal new_apple, apple_attrs assert_equal apple_name, new_apple['name'] end end + + describe 'validation errors' do + before do + @banana = Banana.create(name: 'Dennis') + visit "/admin/bananas/#{@banana.id}/edit" + end + + it 'should error when validation is nil' do + fill_in 'banana[name]', with: nil + click_button 'submit' + + assert page.has_css?('.field_with_errors') + end + + it 'should error when validation is empty' do + fill_in 'banana[name]', with: '' + click_button 'submit' + + assert page.has_css?('.field_with_errors') + end + end end