How to check Ruby version on TW?

18 views
Skip to first unread message

Old Grantonian

unread,
Oct 21, 2014, 3:07:00 AM10/21/14
to test...@googlegroups.com
I use Ruby 2.1.3-x64 and 64 bit DevKit.

The following code works OK:

browser.span(:text => "vListNum").when_present.click

The following code fails:

browser.span(text: "vListNum").when_present.click

The error is:

syntax error, unexpected ':', expecting ')'

On stackOverflow, they suspect that my Ruby is not up to date. How do I check that?

ruby -v says:

ruby 2.1.3p242 (2014-09-19 revision 47630) [x64-mingw32]

Zhimin

unread,
Oct 21, 2014, 6:54:01 PM10/21/14
to test...@googlegroups.com
The Ruby version included in TestWise is 1.8, just as you found out, 
    :text => "vListNum" 
works, the new Ruby syntax for hashes
    text:"vListNum" 
doesn't. 

You don't have to upgrade Ruby in terms of developing automated test scripts, as long as using the first Hash syntax.  The test scripts work fine on Ruby 1.9, 2.0, 2.1 as well.  That's how our typical Test Automation + CI set up.

TestWise IDE for developing tests.
CI Server (e.g. BuildWise, Jenkins) runs Ruby 2.1 to execute all test suite multiple times a day (and do cross-browser testing). 

Reply all
Reply to author
Forward
0 new messages