PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/plugins/plugin_hacks/test/plugin_hacks_test.rb

https://bitbucket.org/josselin_beaumont/music-spaces
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
  1. ENV["RAILS_ENV"] = "test"
  2. require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
  3. require File.join(File.dirname(__FILE__), *%w[.. lib xss_terminate_hack])
  4. plugin_path = File.expand_path(File.dirname(__FILE__)+"/../")
  5. config_location = RAILS_ROOT + "/config/database.yml"
  6. config = YAML::load(ERB.new(IO.read(config_location)).result)
  7. log_file = plugin_path + "/test/test.log"
  8. FileUtils.touch(log_file) unless File.exist?(log_file)
  9. ActiveRecord::Base.logger = Logger.new(log_file)
  10. ActiveRecord::Base.establish_connection(config['test'])
  11. # Test::Unit::TestCase.fixture_path = plugin_path + "/test/fixtures/"
  12. # $LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
  13. class Content < ActiveRecord::Base
  14. xss_terminate :except => [:description, :owner]
  15. end
  16. class PluginHacksTest < Test::Unit::TestCase
  17. # Replace this with your real tests.
  18. def test_xss_terminate
  19. assert_equal([:description, :owner, :description_ru, :description_fr], Content.xss_terminate_options[:except])
  20. end
  21. end