features/support/transforms.rb in message-driver-0.4.0 vs features/support/transforms.rb in message-driver-0.5.0

- old
+ new

@@ -1,17 +1,19 @@ -NUMBER = Transform(/^\d+|no$/) do |num| - case num - when 'no' - 0 +STRING_OR_SYM = Transform(/^:?[A-Za-z]\w*$/) do |str| + case str + when /^:/ + str.slice(1, str.length - 1).to_sym else - num.to_i + str end end -STRING_OR_SYM = Transform(/^:?\w+$/) do |str| - case str - when /^:/ - str.slice(1, str.length-1).to_sym +NUMBER = Transform(/^(?:\d+|a|an|no)$/) do |num| + case num + when 'no' + 0 + when 'a', 'an' + 1 else - str + Integer(num) end end