Sha256: 17e9af1039c2c9c9f705cf153177cb1b9246f231a19f3cb26d31e64a6e04b0fe

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_form-1.1.2 test/action_view_extensions/form_helper_test.rb
simple_form-1.1.1 test/action_view_extensions/form_helper_test.rb
simple_form-1.1.0 test/action_view_extensions/form_helper_test.rb