/vendor/plugins/plugin_hacks/test/plugin_hacks_test.rb
Ruby | 28 lines | 18 code | 7 blank | 3 comment | 0 complexity | 8be86098283842ea8fd53910639cf33b MD5 | raw file
Possible License(s): Apache-2.0, GPL-2.0, JSON, LGPL-2.1, MPL-2.0-no-copyleft-exception
- ENV["RAILS_ENV"] = "test"
- require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
- require File.join(File.dirname(__FILE__), *%w[.. lib xss_terminate_hack])
- plugin_path = File.expand_path(File.dirname(__FILE__)+"/../")
- config_location = RAILS_ROOT + "/config/database.yml"
- config = YAML::load(ERB.new(IO.read(config_location)).result)
- log_file = plugin_path + "/test/test.log"
- FileUtils.touch(log_file) unless File.exist?(log_file)
- ActiveRecord::Base.logger = Logger.new(log_file)
- ActiveRecord::Base.establish_connection(config['test'])
- # Test::Unit::TestCase.fixture_path = plugin_path + "/test/fixtures/"
- # $LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
- class Content < ActiveRecord::Base
- xss_terminate :except => [:description, :owner]
- end
- class PluginHacksTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_xss_terminate
- assert_equal([:description, :owner, :description_ru, :description_fr], Content.xss_terminate_options[:except])
- end
- end