Make sure checkbox values with integers are checked #875

Merged
merged 1 commit into from Jul 28, 2012
@@ -113,7 +113,7 @@ def send_or_call(duck, object)
# Avoids an issue where `send_or_call` can be a String and duck can be something simple like
# `:first`, which obviously String responds to.
def send_or_call_or_object(duck, object)
- return object if object.is_a?(String) # TODO what about other classes etc?
+ return object if object.is_a?(String) || object.is_a?(Integer) # TODO what about other classes etc?
send_or_call(duck, object)
end
@@ -441,7 +441,21 @@
it "should not check any items" do
output_buffer.should have_tag('form li input[@checked]', :count => 0)
- end
+ end
+
+ describe "and the attribute has values" do
+ before do
+ @fred.stub(:posts) { [1] }
+
+ concat(semantic_form_for(@fred) do |builder|
+ concat(builder.input(:posts, :as => :check_boxes, :collection => @_collection))
+ end)
+ end
+
+ it "should check the appropriate items" do
+ output_buffer.should have_tag("form li input[@value='1'][@checked]")
+ end
+ end
end
end