Sha256: 3b2745e73673701a3ba98072ced8ea98a76afbcb6aa04fd22b6f7f014abdf21c

Contents?: true

Size: 1.3 KB

Versions: 16

Compression:

Stored size: 1.3 KB

Contents

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
jquery-ui-form-0.2.8 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.2.7 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.2.6 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.2.5 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.2.4 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.2.3 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.2.2 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.2.1 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.2.0 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.1.6 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.1.5 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.1.4 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.1.3 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.1.2 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.1.1 spec/inputs/radio_input_spec.rb
jquery-ui-form-0.1.0 spec/inputs/radio_input_spec.rb