Permalink
Browse files

Merge pull request #678 from taavo/677_permit_nil_for_select_name

add failing spec for 677 select generates incorrect name when passed nil (only fails prior to 3.0.10)
  • Loading branch information...
2 parents 6625a52 + 13ed3f7 commit d94ee2f5a7a3378f17dd122a6580fbbbd201ad5e @justinfrench committed Sep 26, 2011
Showing with 16 additions and 0 deletions.
  1. +10 −0 spec/inputs/select_input_spec.rb
  2. +6 −0 spec/support/custom_macros.rb
View
10 spec/inputs/select_input_spec.rb
@@ -75,6 +75,16 @@
end
end
end
+
+ describe 'using a nil name' do
+ before do
+ concat(semantic_form_for(@new_post) do |builder|
+ concat(builder.input(:title, :as => :select, :collection => [], :input_html => {:name => nil}))
+ end)
+ end
+
+ it_should_have_select_with_name("post[title]")
+ end
end
describe 'for boolean columns' do
View
6 spec/support/custom_macros.rb
@@ -86,6 +86,12 @@ def it_should_have_input_with_name(name)
end
end
+ def it_should_have_select_with_name(name)
+ it "should have an input named #{name}" do
+ output_buffer.should have_tag("form li select[@name=\"#{name}\"]")
+ end
+ end
+
def it_should_have_textarea_with_name(name)
it "should have an input named #{name}" do
output_buffer.should have_tag("form li textarea[@name=\"#{name}\"]")

0 comments on commit d94ee2f

Please sign in to comment.