Vote #79837
完了"rake db:fixtures:load" does not work
0%
説明
Rails provides a rake task @db:fixtures:load@ to load fixtures to the database. Fixture data is useful to prepare Redmine for testing. But, in Redmine, the task fails due to @test/fixtures/configuration/*.yml@.
$ bin/rake db:fixtures:load rake aborted! ActiveRecord::Fixture::FormatError: fixture key is not a hash: /Users/maeda/redmines/redmine-trunk/test/fixtures/configuration/default.yml, keys: ["production", "development", "test"]
This is because @db:fixtures:load@ assumes that all files which have .yml extension are fixtures. Actually @test/fixtures/configuration/*.yml@ are not fixtures but files used to test @lib/redmine/configuration.rb@.
To run @db:fixtures:load@ without errors, I suggest changing the extension of those files from .yml to another extension such as .yml.txt.
journals
test/fixtures/configuration/*.yml is test data for Redmine::Configuration but it's not fixtures.
I think that this problem will be solved by changing the location of these files.
(eg. test/fixtures/configuration/*.yml -> test/configuration/*.yml)
--------------------------------------------------------------------------------
Currently, all files used by tests are placed under @fixtures@ directory. Here are some examples:
* test/fixtures/diffs
* test/fixtures/ldap
* test/fixtures/mail_handler
I think it is better not to move @text/fixtures/configuration@ outside @fixtures@ directory because it breaks the implicit rule.
--------------------------------------------------------------------------------
Go MAEDA wrote:
> Currently, all files used by tests are placed under @fixtures@ directory. Here are some examples:
>
> * test/fixtures/diffs
> * test/fixtures/ldap
> * test/fixtures/mail_handler
>
> I think it is better not to move @text/fixtures/configuration@ outside @fixtures@ directory because it breaks the implicit rule.
Thank you for pointing out my problem with my patch.
I was not able to notice the current implicit rules...
Certainly, test data not registered in the DB is also placed in test/fixtures.
As suggested by Go Maeda, I made a patch to change the file name.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Maybe ".example" is more appropriate than ".txt"?
--------------------------------------------------------------------------------
Marius BALTEANU wrote:
> Maybe ".example" is more appropriate than ".txt"?
Thanks, looks nicer.
--------------------------------------------------------------------------------
Committed the patch. Thank you for fixing it.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
related_issues
relates,Closed,35466,Rename test/fixtures/configuration/*.yml.example to test/fixtures/files/configuration/*.yml