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