Hi *,
I have a problem in creating fixtures for models with file_column
columns.
superman:
id: 1
image: superman.png
This generates:
- Error:
test_vote_creation_and_deletion(VoteTest):
Errno::ENOENT: No such file or directory - /Users/ngw/zooppa/
config/…/public/assets/image/image/1/superman.png
/Users/ngw/zooppa/config/…/vendor/plugins/file_column/lib/
validations.rb:65:insize' /Users/ngw/zooppa/config/../vendor/plugins/file_column/lib/ validations.rb:65:in
validates_filesize_of’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/validations.rb:302:invalidates_each' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/validations.rb:299:in
each’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/validations.rb:299:invalidates_each' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/validations.rb:822:in
call’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/validations.rb:822:inrun_validations' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/validations.rb:816:in
each’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/validations.rb:816:inrun_validations' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/validations.rb:780:in
valid_without_callbacks?’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/callbacks.rb:299:invalid?' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/associations/association_proxy.rb:123:in
send’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/associations/association_proxy.rb:123:inmethod_missing' /Users/ngw/zooppa/config/../app/models/ad.rb:32:in
before_save’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/callbacks.rb:348:insend' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/callbacks.rb:348:in
callback’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/callbacks.rb:241:increate_or_update' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/base.rb:1545:in
save_without_validation’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/validations.rb:752:insave_without_transactions' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/transactions.rb:129:in
save’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/database_statements.rb:
59:intransaction' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/transactions.rb:95:in
transaction’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/transactions.rb:121:intransaction' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/transactions.rb:129:in
save’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/associations/association_proxy.rb:123:insend' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/associations/association_proxy.rb:123:in
method_missing’
/Users/ngw/zooppa/config/…/app/models/vote.rb:32:inafter_create' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/callbacks.rb:348:in
send’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/callbacks.rb:348:incallback' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/callbacks.rb:255:in
create_without_timestamps’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/timestamp.rb:39:increate' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/base.rb:1789:in
create_or_update_without_callbacks’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/callbacks.rb:242:increate_or_update' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/base.rb:1545:in
save_without_validation’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/validations.rb:752:insave_without_transactions' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/transactions.rb:129:in
save’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/database_statements.rb:
59:intransaction' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/transactions.rb:95:in
transaction’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/transactions.rb:121:intransaction' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/transactions.rb:129:in
save’
./test/unit/vote_test.rb:16:intest_vote_creation_and_deletion' ./test/unit/vote_test.rb:13:in
times’
./test/unit/vote_test.rb:13:in `test_vote_creation_and_deletion’
What I don’t understand is why fixtures work for certain models and
doesn’t work for others … I wrote unit tests for the Image model,
but Rails complains about tests of another model that just loads
those fixtures …
Someone has an idea ?
ngw
–
Nicholas W.
[email protected]