1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00
heartcombo--simple_form/test/form_builder/button_test.rb
Cainã Costa 1e1a2bb73f Add a configuration option to change the class of buttons. Closes #318
This changes the default behavior of having a fixed "button" class
on the buttons.
2011-09-11 23:18:53 -03:00

28 lines
776 B
Ruby

# encoding: UTF-8
require 'test_helper'
class ButtonTest < ActionView::TestCase
def with_button_for(object, *args)
with_concat_form_for(object) do |f|
f.button(*args)
end
end
test 'builder should create buttons' do
with_button_for :post, :submit
assert_select 'form input.button[type=submit][value=Save Post]'
end
test 'builder should create buttons for records' do
@user.new_record!
with_button_for @user, :submit
assert_select 'form input.button[type=submit][value=Create User]'
end
test "builder should use the default class from the configuration" do
swap SimpleForm, :button_class => 'btn' do
with_button_for :post, :submit
assert_select 'form input.btn[type=submit][value=Save Post]'
end
end
end