michaeltelford/wgit

DatabaseHelper.seed single record issue

Closed this issue · 2 comments

DatabaseHelper.seed single record/document issue. Seeding several records/documents works no problem.

seed { url(1) } seeds a single Url and since the url method defaults the number param to 1 seed { url } should do the same thing but it doesn't. Nothing is seeded. The same issue is present for seed { doc }. Therefore I think the issue is to do with the instance_eval inside the seed method but I've not looked into it yet. Maybe url without the round brackets isn't recognized by instance_eval?

This definitely used to work. Not sure what has changed but would be good to fix it. No tests are failing as a result of this issue so the problem is confined to the ./bin/console for the moment. Note that upgrading the ruby version from 2.2.2 to 2.5.3 didn't fix this.

OK, found the issue. There are fixture variables in the console which are shadowing the method calls inside the seed block.

The fix therefore, is to either use brackets (e.g. url(), doc()) inside the seed block or remove/rename the fixture vars to something other than url and doc (which collide with the seed block methods).

There is a wgit executable in the pipline which will likely eval a file for fixtures etc. This would likely remove this issue. If not, then the fixes above would apply.

Therefore, I'm closing the issue.

The seed method is no longer accessible to the ./bin/console so this issue is no longer a problem.