Use Rails test environment to test other kinds of servers


#1

I want to use the very powerful Rails testing framework to test
different kinds of servers (in my case, WordPress with some plugins
I’m developing).

WordPress will run on ‘localhost’ and the database will be local.

I’ll write the models to describe the database, so that Rails has full
visibility into the data. I’ll use the fixtures and everything else.

What’s needed is a way get the POST and GET calls to issue real HTTP
requests (normally, to ‘localhost’) and get the results from these
calls back to Rails. From there, it’s an smooth sail. I’ll be able to
use all the asserting calls and write normal looking tests.

My question is - how do I bend the test environment so that? Where can
I override the normal test code so that it issues real HTTP calls and
collects their output?

Thanks!
Amir Helzer


#2

helzer wrote:
[…]

I’ll write the models to describe the database, so that Rails has full
visibility into the data. I’ll use the fixtures and everything else.

I tend to think this is a bad idea. Rails likes its DB set up a certain
way, and that may or may not correspond to what WordPress expects.

However, you should still be able to use Ruby to test stuff – just
probably without Rails.

What’s needed is a way get the POST and GET calls to issue real HTTP
requests (normally, to ‘localhost’) and get the results from these
calls back to Rails. From

Take a look at Webrat and Selenium. Also check out Cucumber and RSpec.
But don’t expect to throw Rails into the mix.

[…]

Thanks!
Amir Helzer

Best,

Marnen Laibow-Koser
http://www.marnen.org
removed_email_address@domain.invalid