Rails unit testing doesn't load fixtures

后端 未结 6 1109
梦谈多话
梦谈多话 2020-12-16 01:54

rake test:units fails in my current application, because the needed data of the fixtures is missing.

If I\'m loading the fixtures manually via rak

6条回答
  •  渐次进展
    2020-12-16 02:35

    I finally found the problem, although the solutions is kind of hacky.

    One plugin is relying that there is some data in the database, at least one row. So what happened was:

    1. rake loads database schema
    2. rake tries to load environment
    3. environment includes plugin
    4. plugin loading fails because of missing at least one row
    5. no fixtures are loaded

    The hacky solution is: put the needed data directly into schema and not into a fixtures, because it's loaded to late.

    I'll search for a more convenient solution and will update this answer if I found one.

提交回复
热议问题