lib/scoutui/commands/utils.rb in scoutui-2.0.3.26.pre vs lib/scoutui/commands/utils.rb in scoutui-2.0.3.27.pre
- old
+ new
@@ -46,10 +46,19 @@
'__COMPANY.EIN__' => lambda { Faker::Company.ein.to_s },
'__COUNTRY__' => lambda { Faker::Address.country.to_s },
'__DATE__' => lambda { Time.now().to_s },
'__EMAIL__' => lambda { Faker::Internet.email.to_s},
'__DDMMYY__' => lambda { Date.parse(Time.now.to_s).strftime("%d%m%Y") },
+ '__MMDDYY__' => lambda { Date.parse(Time.now.to_s).strftime("%m%d%y") },
+ '__MMDDYY\+\d+__' => lambda { |s|
+ puts __FILE__ + (__LINE__).to_s + " Process s => #{s}"
+ d=s.match(/__MMDDYY\+(\d+)__/)[1]
+ d=(Date.today + d.to_i).strftime("%m%d%y")
+ puts __FILE__ + (__LINE__).to_s + " new date: #{d}"
+ d
+ },
+ '__MMDDYYYY__' => lambda { Date.parse(Time.now.to_s).strftime("%m%d%Y") },
'__PARAGRAPH__' => lambda { Faker::Lorem.paragraph.to_s },
'__PASSWORD__' => lambda { Faker::Internet.password.to_s },
'__PHONENUMBER__' => lambda { Faker::PhoneNumber.phone_number.to_s },
'__PHONENUMBER.AREACODE__' => lambda { Faker::Config.locale = 'en-US'; Faker::PhoneNumber.area_code.to_s },
'__PHONENUMBER.EXCHANGE__' => lambda { Faker::Config.locale = 'en-US'; Faker::PhoneNumber.exchange_code.to_s },
@@ -92,9 +101,12 @@
@transList.each_pair do |_k, _v|
if _text_to_type.include?(_k.to_s)
_dynamicStr = _v.call.to_s
_text_to_type.gsub!(_k.to_s, _dynamicStr)
+ elsif _text_to_type.match(/#{_k.to_s}/)
+ _dynamicStr = _v.call(_text_to_type.to_s)
+ _text_to_type.gsub!(/#{_k.to_s}/, _dynamicStr)
end
end
puts __FILE__ + (__LINE__).to_s + " Text to type : #{_text_to_type}"