spec/errors_spec.rb in formtastic-1.0.1 vs spec/errors_spec.rb in formtastic-1.1.0.beta
- old
+ new
@@ -1,7 +1,7 @@
# coding: utf-8
-require File.dirname(__FILE__) + '/spec_helper'
+require 'spec_helper'
describe 'SemanticFormBuilder#errors_on' do
include FormtasticSpecHelper
@@ -89,12 +89,13 @@
::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|
+ form = semantic_form_for(@new_post) do |builder|
concat(builder.input(:author))
end
+ output_buffer.concat(form) if Formtastic::Util.rails3?
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