require 'spec_helper' describe 'CheckBoxesInput' do include RSpec::Rails::HelperExampleGroup include Webrat::HaveTagMatcher before(:each) do @object = mock({ :new_record? => true, :login => "A" }) end it "should return check boxes tag" do helper.jquery_form_for(:new_post, :as => @object, :url => '/hello') do |builder| builder.object = @object builder.input(:login, :as => :check_boxes, :collection => [["A","a"], ["B","b"]]). should have_tag("input[type='checkbox'].ui-boolean-input" , :count => 2) end end it "should return check boxes tag with options" do helper.jquery_form_for(:new_post, :as => @object, :url => '/hello') do |builder| builder.object = @object builder.input(:login, :as => :check_boxes, :collection => [["A","a"]], "data-name" =>"my-name"). should have_tag("input[type='checkbox'][data-name='my-name'].ui-boolean-input") end end it "should return check boxes tag as buttonset" do helper.jquery_form_for(:new_post, :as => @object, :url => '/hello') do |builder| builder.object = @object a = builder.input(:login, :as => :check_boxes, :buttonset => true, :collection => [["A","a"], ["B","b"]]) a.should have_tag("input[type='checkbox'].ui-boolean-input" , :count => 2) a.should have_tag("fieldset.to-buttonset") end end end