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/test_helper.rb
2009-12-10 19:52:23 -02:00

61 lines
1.1 KiB
Ruby

require 'rubygems'
require 'test/unit'
require 'action_controller'
require 'action_view/test_case'
begin
require 'ruby-debug'
rescue LoadError
end
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib', 'simple_form')
require 'simple_form'
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
I18n.default_locale = :en
class SimpleForm::FormBuilder
attr_accessor :attribute, :column, :input_type, :options
end
class ActionView::TestCase
include MiscHelpers
tests SimpleForm::ActionViewExtensions::FormHelper
setup :set_controller
setup :set_response
setup :setup_new_user
def set_controller
@controller = MockController.new
end
def set_response
@response = MockResponse.new(self)
end
def setup_new_user(options={})
@user = User.new({
:id => 1,
:name => 'New in Simple Form!',
:description => 'Hello!',
:created_at => Time.now
}.merge(options))
end
def protect_against_forgery?
false
end
def params
@params ||= {}
end
def user_path(*args)
'/users'
end
alias :users_path :user_path
alias :super_user_path :user_path
end