test/test_helper.rb in radius-ts-1.1.0 vs test/test_helper.rb in radius-ts-1.3.0
- old
+ new
@@ -1,5 +1,6 @@
+require 'rubygems'
require 'timeout'
unless defined? RADIUS_LIB
RADIUS_LIB = File.join(File.dirname(__FILE__), '..', 'lib')
@@ -13,12 +14,15 @@
def new_context
Radius::Context.new do |c|
c.define_tag("reverse" ) { |tag| tag.expand.reverse }
c.define_tag("capitalize") { |tag| tag.expand.upcase }
- c.define_tag("attr" ) { |tag| tag.attr.inspect }
c.define_tag("echo" ) { |tag| tag.attr['value'] }
c.define_tag("wrap" ) { |tag| "[#{tag.expand}]" }
+ c.define_tag("attr") do |tag|
+ kv = tag.attr.keys.sort.collect{|k| "#{k.inspect}=>#{tag[k].inspect}"}
+ "{#{kv.join(', ')}}"
+ end
end
end
def define_tag(name, options = {}, &block)
@parser.context.define_tag name, options, &block