Hi, i have a problem that any of my rspec rake tasks fail with the following error: rake -f unittests.rake spec ** Invoke spec (first_time) ** Execute spec C:/Ruby18/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/logger.rb:53: undefined method `datetime_format='' for class `Logger'' (NameError) from C:/Ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'' from C:/Ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'' from C:/Ruby18/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext.rb:8 from C:/Ruby18/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext.rb:8:in `each'' from C:/Ruby18/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext.rb:8 from C:/Ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'' from C:/Ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'' from C:/Ruby18/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support.rb:56 ... 11 levels... from C:/Ruby18/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in `load_file s'' from C:/Ruby18/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:133:in `run_examples'' from C:/Ruby18/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'' from C:/Ruby18/lib/ruby/gems/1.8/gems/rspec-1.3.0/bin/spec:5 rake aborted! My rake tasks are trivial like this: Spec::Rake::SpecTask.new do |t| t.spec_files = FileList[''lib/deposit_handler/spec/*.rb''] end I am watir+rspec. Could the problem be that activesupport being a part of rails is missing some dependencies? Googling around did not seem to bring any results. -- View this message in context: http://old.nabble.com/rspec-rake-tasks-fail-inside-active-record-tp29084492p29084492.html Sent from the rspec-users mailing list archive at Nabble.com.
David Chelimsky
2010-Jul-06 13:02 UTC
[rspec-users] rspec rake tasks fail inside active record
On Jul 6, 2010, at 6:49 AM, andreyr wrote:> Hi, > > i have a problem that any of my rspec rake tasks fail with the following > error: > rake -f unittests.rake spec > ** Invoke spec (first_time) > ** Execute spec > C:/Ruby18/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/logger.rb:53: > undefined method `datetime_format='' for class `Logger'' (NameError) > from > C:/Ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `gem_original_require'' > from > C:/Ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'' > from > C:/Ruby18/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext.rb:8 > from > C:/Ruby18/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext.rb:8:in > `each'' > from > C:/Ruby18/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext.rb:8 > from > C:/Ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in > `gem_original_require'' > from > C:/Ruby18/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'' > from > C:/Ruby18/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support.rb:56 > ... 11 levels... > from > C:/Ruby18/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in > `load_file > s'' > from > C:/Ruby18/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:133:in > `run_examples'' > from > C:/Ruby18/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in > `run'' > from C:/Ruby18/lib/ruby/gems/1.8/gems/rspec-1.3.0/bin/spec:5 > rake aborted! > > My rake tasks are trivial like this: > Spec::Rake::SpecTask.new do |t| > t.spec_files = FileList[''lib/deposit_handler/spec/*.rb''] > end > > I am watir+rspec. Could the problem be that activesupport being a part of > rails is missing some dependencies? Googling around did not seem to bring > any results.We need to see some code. Please post the Rakefile and spec file.
Hi David, it would be difficult to do as I would need to post something like 15 files that are used in the spec file, otherwise the code would make no sense. However, I have solved the problem. While trying to make a meaningful example for you, I narrowed the problem down to the single line of code which is require ''firewatir'' This is an older module not needed anymore and it was creating the problem. After dropping it things started to work. It definitely was not an rspec problem, even though it looked so from the error messages. I am still wondering why running the same spec file with the spec command worked but with rake did not. I noticed that the list of loaded modules is different when running with spec as compared to running with rake. Spec loads activesupport much earlier than rake and I think this is the answer - by the time when firewatir wants to access logger in case of using spec it''s already there but in case of rake not. Anyway the problem is solved, thanks for your help. David Chelimsky-2 wrote:> > > We need to see some code. Please post the Rakefile and spec file. > >-- View this message in context: http://old.nabble.com/rspec-rake-tasks-fail-inside-active-record-tp29084492p29100748.html Sent from the rspec-users mailing list archive at Nabble.com.