spec/errors_spec.rb in formtastic-0.9.8 vs spec/errors_spec.rb in formtastic-0.9.9
- old
+ new
@@ -79,7 +79,26 @@
end
end
end
end
+
+ describe 'when there are errors on the association and column' do
+
+ it "should list all unique errors" do
+ ::Formtastic::SemanticFormBuilder.inline_errors = :list
+ ::Post.stub!(:reflections).and_return({:author => mock('reflection', :options => {}, :macro => :belongs_to)})
+
+ @errors.stub!(:[]).with(:author).and_return(['must not be blank'])
+ @errors.stub!(:[]).with(:author_id).and_return(['is already taken', 'must not be blank']) # note the duplicate of association
+
+ semantic_form_for(@new_post) do |builder|
+ concat(builder.input(:author))
+ end
+ output_buffer.should have_tag("ul.errors li", /must not be blank/, :count => 1)
+ output_buffer.should have_tag("ul.errors li", /is already taken/, :count => 1)
+ end
+
+ end
+
end