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

53 lines
1,016 B
Ruby

require 'rubygems'
require 'test/unit'
require 'i18n'
require 'action_controller'
require 'action_view/test_case'
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
require File.join(File.dirname(__FILE__), '..', 'lib', 'simple_form')
I18n.default_locale = :en
class ActionView::TestCase
include I18nHelper
tests SimpleForm::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
@user = User.new(
:name => 'New in Simple Form!',
:description => 'Hello!',
:created_at => Time.now
)
end
def protect_against_forgery?
false
end
def user_path(*args)
'/users'
end
alias :super_user_path :user_path
# Wrapper to assert no select exists
def assert_no_select(*args)
assert_raise Test::Unit::AssertionFailedError do
assert_select(*args)
end
end
end