Test suite before upgrade to rails 4.2 from rails 3.2
I recently tried to updated my Rails app from Rails 3.2 to Rails 4.2. Before the upgrade all my test suite runs perfectly, but after the update I'm getting something strange. every time i tried to run a test the same error happens
rake db:fixtures:load --trace ** Invoke db:fixtures:load (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:fixtures:load rake aborted! NameError: uninitialized constant ActiveRecord::FixtureSet::RenderContext::MassiveMessage (erb):11:in `get_binding' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/erb.rb:863:in `eval' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/erb.rb:863:in `result' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:42:in `render' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:33:in `rows' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:24:in `each' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:758:in `block (2 levels) in read_fixture_files' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:15:in `open' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:757:in `block in read_fixture_files' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `each' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `each_with_object' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `read_fixture_files' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:592:in `initialize' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:514:in `new' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:514:in `block (2 levels) in create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:511:in `map' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:511:in `block in create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:282:in `disable_referential_integrity' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:508:in `create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:203:in `block (3 levels) in ' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `call' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `each' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `execute' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:165:in `invoke' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `each' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:100:in `top_level' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:78:in `block in run' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:75:in `run' /home/alexander/.rvm/rubies/ruby-2.2.0/bin/rake:33:in `'
Can anyone help me with this?
After deleting that Fixtures i get another error see
rake aborted! TypeError: no implicit conversion of Fixnum into String /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:636:in `gsub' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:636:in `block (2 levels) in table_rows' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:635:in `each' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:635:in `block in table_rows' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `each' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `map' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `table_rows' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:526:in `block (3 levels) in create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:524:in `each' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:524:in `block (2 levels) in create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:523:in `block in create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:282:in `disable_referential_integrity' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:508:in `create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:203:in `block (3 levels) in ' Tasks: TOP => db:fixtures:load (See full trace by running task with --trace)
:( I did a progressive updatefrom rails 3.2 to 4.02, then from 4.02 to 4.1, all worked smoothly, then at rails 4.2 i got the same error
i posted the issue at github in rails repositories and they answer me that it's a bug and will be released at version 4.2.1
for the moment you can correct this doing this. row[key] = value.gsub("$LABEL", label. to_s ) if value.is_a?(String) at line 636 of the file fixture.rb from activerecord library
链接地址: http://www.djcxy.com/p/49944.html上一篇: 无法找到表格主题禁用