Nondestructive testing environment on legacy db

Hi,

I’ve been trying to Google for an answer to this, but the suggestions
I’ve
found have been either contradictory or seemingly outdated.

I’m building a Rails frontend for a legacy Oracle database, and I want
to do
proper tests with RSpec/Cucumber. What I can’t seem to figure out is how
to
run tests without destroying and rebuilding the database.
I’m well aware that that’s the ‘best practice’ way of doing it… but
I’m
dealing with a massive, >6GB beast with hundreds of tables, byzantine
constraints, and a rat’s nest of spaghetti code in the form of triggers
and
stored procs.

Seriously, I have nightmares about this database as well.

But, I’ve been slogging away at it, and created a web app that’s
impressed
the bosses, and the vendor for that matter. But I also have nightmares
about
the fact that I don’t have a test suite. This horrifies me.

What I’d like to do is test against the dev db, since if it gets
horribly
b0rked, I can restore from the previous night’s ComVault backup.

I saw the suggestion to edit the rake task in the old rspec_on_rails
plugin
so that

spec_prereq = :noop

I was curious if there was a good way to do this with the current
rspec-rails gem…

I’m on Ruby 1.9.2 and Rails 3.0.4

Thanks,

Jason L.

Email [email protected]

Mobile 414.310.2665

Blog: http://duckpunching.wordpress.com/

On Thu, Mar 3, 2011 at 2:56 PM, Jason L. [email protected]
wrote:

Hi,

I’ve been trying to Google for an answer to this, but the suggestions I’ve
found have been either contradictory or seemingly outdated.

I’m building a Rails frontend for a legacy Oracle database, and I want to
do proper tests with RSpec/Cucumber. What I can’t seem to figure out is how
to run tests without destroying and rebuilding the database.

I would recommend isolating your test data. Ideally put it into
something
like Factories (Factory Girl, Machinist,etc) as much as possible. Try to
focus in specifically on exactly what you are testing. I am not the best
example (yet) but my current project has also shown me why it is good to
mock and stub rather than depend on data (I am dealing with legacy
data).

As for the db – couldn’t you just backup the oracle db and dump the
data
out of it? I am assuming you are using the legacy schema and not the
rails
schema way of doing things. Ideally get to an empty db that you can tell
your test suite to recreate each time you run your tests.

I’m well aware that that’s the ‘best practice’ way of doing it… but
I’m

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs