ngauthier/hydra

DB Related Question.

rurounijones opened this issue · 4 comments

Can I use hydra if I have rspec tests where the before(:each) block contains something like
before(:each) do
User.destroy_all
@user = Factory(:user)
end

Or any other tests that rely on counting database record numbers? (For example a test that uploads initial / additional CSV files and checks that the correct number of rows are inserted into the DB).

All these tests are in the same rspec describe block, I am not sure at what level hydra splits out tests.

I am also using MongoMapper and MongoDB, not ActiveRecord and an SQL Database

From what I have read in some of the other posts these kinds of tests will fail due to sharing a database?

The only way to really know is to try! It only takes a few minutes to setup Hydra.

I have a number of "count the difference" tests and they do fine. The destroy_all might cause an issue but I'm not sure.

Hydra uses ActiveRecord's concurrency to handle database issues, so it should be fine with Mongo.

Give it a shot! And please let me know how it goes.

Unfortunately I only have a 1 core machine (slow-ass celeron) at work (at the moment) so I cannot really test Hydra properly I think which is why I asked.

I hope to be getting a multi-core machine soon which is why I wanted to do some checking before-hand.

If anyone is in the same boat and knows the answer, speak up! :)

oh also, I forgot to mention: hydra splits at the file-level. So if conflicting code is in the same file, you're fine.

If you have code in two different files that conflict, you may be in trouble.

Groovy, very useful information, thank yo very much.