[openstreetmap/openstreetmap-website] Replace trace-related fixtures with factories. (#1347)

Tom Hughes notifications at github.com
Sat Dec 17 17:46:13 UTC 2016

So I've had another look through this and it's mostly fine but I'm still not convinced the stubbing approach is right, and I thought I had come up with a better plan then I saw what @gravitystorm wrote above:

> A completely different approach would be to create the test instances, and then copy around the necessary gpx files within the test directory and rename the files to give them the ids assigned by factorygirl. But that seems even worse to me.

Which is pretty much exactly the plan I had come up with... To have a set of fixtures (yes I know...) which are the various files we want to be able to use and a separate directory which is the active spool being used by rails and when we need to we tell factory girl which data to use and it copies it over, otherwise it just creates default empty files or something.

It seems to me that is a more accurate test in that it doesn't wind up with us testing the stubs rather than the real code, and it more accurately models things - a trace that exists in the database should have corresponding files on disk - that is basically an expected invariant of the code - so when the factory creates a trace object it should also create the corresponding files.

So I'm interested in why you think it's a worse solution?

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20161217/b84f9568/attachment.html>

More information about the rails-dev mailing list