Sha256: fe20788fd3d5530728e31b2c5448ed9c01fccb41b9bf9a2fc67975a6d9608966

Contents?: true

Size: 1.48 KB

Versions: 5

Compression:

Stored size: 1.48 KB

Contents

require 'test_helper'

class FormHelperTest < ActionView::TestCase

  test 'simple form for yields an instance of FormBuilder' do
    simple_form_for :user do |f|
      assert f.instance_of?(SimpleForm::FormBuilder)
    end
  end

  test 'simple form should add default class to form' do
    simple_form_for :user do |f| end
    assert_select 'form.simple_form'
  end

  test 'simple form should add object name as css class to form when object is not present' do
    simple_form_for :user do |f| end
    assert_select 'form.simple_form.user'
  end

  test 'simple form should add object class name as css class to form' do
    simple_form_for @user do |f| end
    assert_select 'form.simple_form.user'
  end

  test 'pass options to simple form' do
    simple_form_for :user, :url => '/account', :html => { :id => 'my_form' } do |f| end
    assert_select 'form#my_form'
    assert_select 'form[action=/account]'
  end

  test 'fields for yields an instance of FormBuilder' do
    simple_fields_for :user do |f|
      assert f.instance_of?(SimpleForm::FormBuilder)
    end
  end

  test 'remote form for yields an instance of FormBuilder' do
    simple_remote_form_for :user do |f|
      assert f.instance_of?(SimpleForm::FormBuilder)
    end
    assert_select "form[onsubmit]"
  end

  test 'pass options to simple remote form' do
    simple_remote_form_for :user, :url => '/account', :html => { :id => 'my_form' } do |f| end
    assert_select 'form#my_form'
    assert_select 'form[action=/account]'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_form-1.0.4 test/action_view_extensions/form_helper_test.rb
simple_form-1.0.3 test/action_view_extensions/form_helper_test.rb
simple_form-1.0.2 test/action_view_extensions/form_helper_test.rb
simple_form-1.0.1 test/action_view_extensions/form_helper_test.rb
simple_form-1.0.0 test/action_view_extensions/form_helper_test.rb