instiki/vendor/plugins/erubis-2.6.5/test/test-users-guide.rb
Jacques Distler a5e08f7bcc Rails_xss Plugin
I installed the rails_xss plugin, for
the main purpose of seeing what will
break with Rails 3.0 (where the behaviour
of the plugin is the default). I think
I've fixed everything, but let me know if you
see stuff that is HTML-escaped, which
shouldn't be.

As a side benefit, we now use Erubis,
rather than ERB, to render templates.
They tell me it's faster ...
2010-05-26 00:27:49 -05:00

58 lines
1 KiB
Ruby

###
### $Release: 2.6.5 $
### copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
###
require "#{File.dirname(__FILE__)}/test.rb"
class KwarkUsersGuideTest < Test::Unit::TestCase
DIR = File.expand_path(File.dirname(__FILE__) + '/data/users-guide')
CWD = Dir.pwd()
def setup
Dir.chdir DIR
end
def teardown
Dir.chdir CWD
end
def _test
@name = (caller()[0] =~ /`(.*?)'/) && $1
s = File.read(@filename)
s =~ /\A\$ (.*?)\n/
command = $1
expected = $'
result = `#{command}`
assert_text_equal(expected, result)
end
Dir.chdir DIR do
filenames = []
filenames += Dir.glob('*.result')
filenames += Dir.glob('*.source')
filenames.each do |filename|
name = filename.gsub(/[^\w]/, '_')
s = <<-END
def test_#{name}
# $stderr.puts "*** debug: test_#{name}"
@name = '#{name}'
@filename = '#{filename}'
_test()
end
END
eval s
end
end
self.post_definition()
end