Topic: help - watir testing in a rails context ?

I'm relatively new to both ruby and RoR so I'm hoping there is something simple to enable me to complete my task.

I have a suite of standalone Watir tests that run successfully against my webapp (so far so good), but instead of parsing the http response text for clues as to whether the operations were successful (as I am currently doing), I would like to programmatically access the data and check it directly. ie: I would like to use ActiveRecord to verify the data I entered via the browser was successfully stored. Having the context of the Rails app would also allow me to setup test data easily.

The Rails wiki has a page that looks promising*, but refers to mystery files (test_helper ??) and is perhaps too advanced in it's use of Test::Unit for my newbie sensibilities.  (what's up with that END block before the 'require' statements ?)

Any help/pointers appreciated.

* http://wiki.rubyonrails.org/rails/pages … sWithWatir

Re: help - watir testing in a rails context ?

I'm not familiar at all with watir, but you can include the entire rails environment into any ruby script like this:

require '/path/to/environment.rb'

Then you should have access to the models and everything.

Railscasts - Free Ruby on Rails Screencasts

Re: help - watir testing in a rails context ?

ryanb wrote:

I'm not familiar at all with watir, but you can include the entire rails environment into any ruby script like this:

require '/path/to/environment.rb'

Then you should have access to the models and everything.

sweet.. that did the trick. though now I realize that my app is *nix dependent (it uses backgroundrb) but the tests are windows dependent (watir really only supports IE). ugh.

/me wishes everything was native ruby.