##Integration capybara with minitest
Requirements:
- ruby 1.9
- gem capybara
All you have to do is to require file test_helper.rb at the beginning of your test files.
| class Test::Unit::TestCase | |
| private | |
| def reload_activerecord_instances | |
| self.instance_variables.each do |ivar| | |
| if ivar.is_a?(ActiveRecord::Base) && ivar.respond_to?(:reload) | |
| ivar.reload | |
| end | |
| end | |
| end |
| /* | |
| * object.watch polyfill | |
| * | |
| * 2012-04-03 | |
| * | |
| * By Eli Grey, http://eligrey.com | |
| * Public Domain. | |
| * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
| */ |
##Integration capybara with minitest
Requirements:
All you have to do is to require file test_helper.rb at the beginning of your test files.
| # lib/custom_form_builder.rb | |
| # See https://github.com/plataformatec/simple_form#custom-form-builder | |
| class CustomFormBuilder < SimpleForm::FormBuilder | |
| def input(attribute_name, options = {}, &block) | |
| if options[:wrapper_html] | |
| options[:wrapper_html].merge! class: 'form-group' | |
| else | |
| options[:wrapper_html] = { class: 'form-group' } | |
| end |
| # http://stackoverflow.com/questions/14972253/simpleform-default-input-class | |
| # https://github.com/plataformatec/simple_form/issues/316 | |
| inputs = %w[ | |
| CollectionSelectInput | |
| DateTimeInput | |
| FileInput | |
| GroupedCollectionSelectInput | |
| NumericInput | |
| PasswordInput |
| #app/inputs/collection_check_boxes_input.rb | |
| class CollectionCheckBoxesInput < SimpleForm::Inputs::CollectionCheckBoxesInput | |
| def item_wrapper_class | |
| "checkbox-inline" | |
| end | |
| end |