0

In my rails 3.2.15 project I'm getting inconsistent failures in my specs coming from active_support/multibyte/unicode.rb. Sometimes the specs fail, sometimes they pass. I haven't seen it outside of the tests, though. It's in the same particular area of the code each time. It seems to be the area where ActiveSupport is loading unicode_tables.dat. What's even more baffling is that if I go into ActiveSupport to the line in question and prepend it with p to output the values, it actually passes where it failed before and fails further on. FriendlyId is in the stack, so I'm wondering if that has anything to do with the problem. The line in my code that triggers the exception is just update_attributes!(:pdf_processing => false). What am I missing?

 NoMethodError:
   undefined method `each' for nil:NilClass
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:350:in `load'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:335:in `codepoints'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:158:in `block in decompose_codepoints'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:147:in `each'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:147:in `inject'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:147:in `decompose_codepoints'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/multibyte/unicode.rb:291:in `normalize'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/inflector/transliterate.rb:62:in `transliterate'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/inflector/transliterate.rb:84:in `parameterize'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/core_ext/string/inflections.rb:155:in `parameterize'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/friendly_id-4.0.10.1/lib/friendly_id/slugged.rb:245:in `normalize_friendly_id'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/friendly_id-4.0.10.1/lib/friendly_id/slugged.rb:262:in `should_generate_new_friendly_id?'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/friendly_id-4.0.10.1/lib/friendly_id/slugged.rb:273:in `set_slug'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:407:in `_run__895003607475416689__validation__177331951454965097__callbacks'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:405:in `__run_callback'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:385:in `_run_validation_callbacks'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:81:in `run_callbacks'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activemodel-3.2.15/lib/active_model/validations/callbacks.rb:53:in `run_validations!'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activemodel-3.2.15/lib/active_model/validations.rb:195:in `valid?'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/validations.rb:69:in `valid?'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/validations.rb:77:in `perform_validations'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/validations.rb:56:in `save!'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:264:in `block in save!'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:208:in `transaction'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:264:in `save!'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/persistence.rb:228:in `block in update_attributes!'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:208:in `transaction'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.15/lib/active_record/persistence.rb:226:in `update_attributes!'
 # ./app/models/campaign.rb:291:in `ensure in generate_pdf'
 # ./app/models/campaign.rb:291:in `generate_pdf'
 # ./spec/models/campaign/generate_pdf_spec.rb:53:in `block (3 levels) in <top (required)>'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:114:in `instance_eval'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:114:in `block in run'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:254:in `with_around_each_hooks'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:111:in `run'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:390:in `block in run_examples'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:386:in `map'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:386:in `run_examples'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:371:in `run'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:372:in `block in run'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:372:in `map'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:372:in `run'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:28:in `map'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:28:in `block in run'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/reporter.rb:58:in `report'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:25:in `run'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/test_framework/rspec.rb:11:in `run_tests'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:13:in `block in run'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/forker.rb:21:in `block in initialize'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/forker.rb:18:in `fork'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/forker.rb:18:in `initialize'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:9:in `new'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:9:in `run'
 # /home/fletch/.rvm/gems/ruby-1.9.3-p484/gems/spork-0.9.2/lib/spork/server.rb:48:in `run'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
 # /home/fletch/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
lobati
  • 9,284
  • 5
  • 40
  • 61

1 Answers1

0

Forehead slap. We're stubbing File.open in our specs.

lobati
  • 9,284
  • 5
  • 40
  • 61