<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer">7315</assigned-user-id>
  <attachments-count type="integer">1</attachments-count>
  <closed type="boolean">true</closed>
  <created-at type="datetime">2008-08-22T19:03:09+02:00</created-at>
  <creator-id type="integer">24</creator-id>
  <milestone-due-on type="datetime">2009-01-11T00:00:00+01:00</milestone-due-on>
  <milestone-id type="integer">21779</milestone-id>
  <number type="integer">503</number>
  <permalink>rspec-fails-to-finish-running-properly-depending-on-load-order</permalink>
  <priority type="integer">16</priority>
  <project-id type="integer">5645</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>resolved</state>
  <tag>bug patch</tag>
  <title>RSpec fails to finish running properly depending on load order</title>
  <updated-at type="datetime">2008-11-28T17:34:16+01:00</updated-at>
  <user-id type="integer">7315</user-id>
  <user-name>David Chelimsky</user-name>
  <creator-name>eventualbuddha</creator-name>
  <assigned-user-name>David Chelimsky</assigned-user-name>
  <url>http://rspec.lighthouseapp.com/projects/5645/tickets/503</url>
  <milestone-title>1.1.12</milestone-title>
  <original-body>This is the error that occurs:

/var/lib/gems/1.8/gems/rspec-1.1.4/lib/spec.rb:27:in `exit?': undefined method `run?' for Test::Unit:Module (NoMethodError)
        from /var/lib/gems/1.8/gems/rspec-1.1.4/lib/spec/runner.rb:193:in `register_at_exit_hook'
        from spec/dsl_spec.rb:3

This doesn't happen on every machine, but it happens every time on my Ubuntu Linux 64-bit continuous integration machine when the following are true:

1) RSpec is loaded while Object.const_defined?(:Test) is false
2) Spec.exit? is called while Object.const_defined?(:Test) is true
3) test/unit has not been loaded

My particular way to cause this was to have a spec_helper.rb file that looked like this:

require 'rubygems'
require 'spec'

require File.dirname(__FILE__) + '/../lib/myproject'

Where the project in question loaded ActiveRecord and, by implication, ActiveSupport, which doesn't actually load test/unit but defines the Test::Unit module. Therefore when Spec.exit? is called, it assumes test/unit has been loaded and calls Test::Unit.run?, resulting in the above error.

Someone else had the same problem: https://www.ruby-forum.com/topic/155487

A workaround is to require 'spec' only after your app code has been initialized, so either Test will be there or it won't.</original-body>
  <latest-body>This is the error that occurs:

/var/lib/gems/1.8/gems/rspec-1.1.4/lib/spec.rb:27:in `exit?': undefined method `run?' for Test::Unit:Module (NoMethodError)
        from /var/lib/gems/1.8/gems/rspec-1.1.4/lib/spec/runner.rb:193:in `register_at_exit_hook'
        from spec/dsl_spec.rb:3

This doesn't happen on every machine, but it happens every time on my Ubuntu Linux 64-bit continuous integration machine when the following are true:

1) RSpec is loaded while Object.const_defined?(:Test) is false
2) Spec.exit? is called while Object.const_defined?(:Test) is true
3) test/unit has not been loaded

My particular way to cause this was to have a spec_helper.rb file that looked like this:

require 'rubygems'
require 'spec'

require File.dirname(__FILE__) + '/../lib/myproject'

Where the project in question loaded ActiveRecord and, by implication, ActiveSupport, which doesn't actually load test/unit but defines the Test::Unit module. Therefore when Spec.exit? is called, it assumes test/unit has been loaded and calls Test::Unit.run?, resulting in the above error.

Someone else had the same problem: https://www.ruby-forum.com/topic/155487

A workaround is to require 'spec' only after your app code has been initialized, so either Test will be there or it won't.</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;This is the error that occurs:&lt;/p&gt;

&lt;p&gt;/var/lib/gems/1.8/gems/rspec-1.1.4/lib/spec.rb:27:in &lt;code&gt;exit?': undefined method&lt;/code&gt;run?' for Test::Unit:Module (NoMethodError)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    from /var/lib/gems/1.8/gems/rspec-1.1.4/lib/spec/runner.rb:193:in `register_at_exit_hook'
    from spec/dsl_spec.rb:3
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This doesn't happen on every machine, but it happens every time on my Ubuntu Linux 64-bit continuous integration machine when the following are true:&lt;/p&gt;

&lt;p&gt;1) RSpec is loaded while Object.const_defined?(:Test) is false
2) Spec.exit? is called while Object.const_defined?(:Test) is true
3) test/unit has not been loaded&lt;/p&gt;

&lt;p&gt;My particular way to cause this was to have a spec_helper.rb file that looked like this:&lt;/p&gt;

&lt;p&gt;require 'rubygems'
require 'spec'&lt;/p&gt;

&lt;p&gt;require File.dirname(&lt;strong&gt;FILE&lt;/strong&gt;) + '/../lib/myproject'&lt;/p&gt;

&lt;p&gt;Where the project in question loaded ActiveRecord and, by implication, ActiveSupport, which doesn't actually load test/unit but defines the Test::Unit module. Therefore when Spec.exit? is called, it assumes test/unit has been loaded and calls Test::Unit.run?, resulting in the above error.&lt;/p&gt;

&lt;p&gt;Someone else had the same problem: &lt;a href=&quot;https://www.ruby-forum.com/topic/155487&quot;&gt;https://www.ruby-forum.com/topic...&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A workaround is to require 'spec' only after your app code has been initialized, so either Test will be there or it won't.&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>This is the error that occurs:

    /var/lib/gems/1.8/gems/rspec-1.1.4/lib/spec.rb:27:in `exit?': undefined method `run?' for Test::Unit:Module (NoMethodError)
        from /var/lib/gems/1.8/gems/rspec-1.1.4/lib/spec/runner.rb:193:in `register_at_exit_hook'
        from spec/dsl_spec.rb:3

This doesn't happen on every machine, but it happens every time on my Ubuntu Linux 64-bit continuous integration machine when the following are true:

  1. RSpec is loaded while `Object.const_defined?(:Test)` is `false`
  2. `Spec.exit?` is called while `Object.const_defined?(:Test)` is `true`
  3. `test/unit` has not been loaded

My particular way to cause this was to have a spec_helper.rb file that looked like this:

    require 'rubygems'
    require 'spec'
    
    require File.dirname(__FILE__) + '/../lib/myproject'

Where the project in question loaded ActiveRecord and, by implication, ActiveSupport, which doesn't actually load `test/unit` but defines the `Test::Unit` module. Therefore when `Spec.exit?` is called, it assumes `test/unit` has been loaded and calls `Test::Unit.run?`, resulting in the above error.

Someone else had the same problem: https://www.ruby-forum.com/topic/155487

A workaround is to require 'spec' only after your app code has been initialized, so either `Test` will be there or it won't.

My commit on github: http://github.com/eventualbuddha/rspec/commit/9dbeb477225dd877b437f4b2c4081de7794e30a7</body>
      <body-html>&lt;div&gt;&lt;p&gt;This is the error that occurs:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/var/lib/gems/1.8/gems/rspec-1.1.4/lib/spec.rb:27:in `exit?': undefined method `run?' for Test::Unit:Module (NoMethodError)
    from /var/lib/gems/1.8/gems/rspec-1.1.4/lib/spec/runner.rb:193:in `register_at_exit_hook'
    from spec/dsl_spec.rb:3
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This doesn't happen on every machine, but it happens every time on my Ubuntu Linux 64-bit continuous integration machine when the following are true:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;RSpec is loaded while &lt;code&gt;Object.const_defined?(:Test)&lt;/code&gt; is &lt;code&gt;false&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Spec.exit?&lt;/code&gt; is called while &lt;code&gt;Object.const_defined?(:Test)&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;test/unit&lt;/code&gt; has not been loaded&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;My particular way to cause this was to have a spec_helper.rb file that looked like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;require 'rubygems'
require 'spec'

require File.dirname(__FILE__) + '/../lib/myproject'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Where the project in question loaded ActiveRecord and, by implication, ActiveSupport, which doesn't actually load &lt;code&gt;test/unit&lt;/code&gt; but defines the &lt;code&gt;Test::Unit&lt;/code&gt; module. Therefore when &lt;code&gt;Spec.exit?&lt;/code&gt; is called, it assumes &lt;code&gt;test/unit&lt;/code&gt; has been loaded and calls &lt;code&gt;Test::Unit.run?&lt;/code&gt;, resulting in the above error.&lt;/p&gt;

&lt;p&gt;Someone else had the same problem: &lt;a href=&quot;https://www.ruby-forum.com/topic/155487&quot;&gt;https://www.ruby-forum.com/topic...&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A workaround is to require 'spec' only after your app code has been initialized, so either &lt;code&gt;Test&lt;/code&gt; will be there or it won't.&lt;/p&gt;

&lt;p&gt;My commit on github: &lt;a href=&quot;http://github.com/eventualbuddha/rspec/commit/9dbeb477225dd877b437f4b2c4081de7794e30a7&quot;&gt;http://github.com/eventualbuddha...&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-08-22T19:14:08+02:00</created-at>
      <creator-id type="integer">24</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">503</number>
      <permalink>rspec-fails-to-finish-running-properly-depending-on-load-order</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">5645</project-id>
      <state>new</state>
      <tag>bug patch</tag>
      <title>RSpec fails to finish running properly depending on load order</title>
      <updated-at type="datetime">2008-08-22T19:14:08+02:00</updated-at>
      <user-id type="integer">24</user-id>
      <user-name>eventualbuddha</user-name>
      <creator-name>eventualbuddha</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rspec.lighthouseapp.com/projects/5645/tickets/503</url>
      <milestone-title nil="true"></milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>(from [7003e448de1d8ddcf31fc0198a8dd71a56e9ff70]) Check whether test/unit has really been loaded before calling a method it defines.

[#503 state:resolved]
http://github.com/dchelimsky/rspec/commit/7003e448de1d8ddcf31fc0198a8dd71a56e9ff70</body>
      <body-html>&lt;div&gt;&lt;p&gt;(from [7003e448de1d8ddcf31fc0198a8dd71a56e9ff70]) Check whether
test/unit has really been loaded before calling a method it
defines.&lt;/p&gt;
&lt;p&gt;[&lt;a href=&quot;/projects/5645/tickets/503&quot; title=&quot;Ticket #503&quot;&gt;#503&lt;/a&gt; state:resolved] &lt;a href=&quot;http://github.com/dchelimsky/rspec/commit/7003e448de1d8ddcf31fc0198a8dd71a56e9ff70&quot;&gt;
http://github.com/dchelimsky/rsp...&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-11-28T17:34:00+01:00</created-at>
      <creator-id type="integer">24</creator-id>
      <diffable-attributes type="yaml">--- 
:state: new
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">503</number>
      <permalink>rspec-fails-to-finish-running-properly-depending-on-load-order</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">5645</project-id>
      <state>resolved</state>
      <tag>bug patch</tag>
      <title>RSpec fails to finish running properly depending on load order</title>
      <updated-at type="datetime">2008-11-28T17:34:01+01:00</updated-at>
      <user-id type="integer">7315</user-id>
      <user-name>David Chelimsky</user-name>
      <creator-name>eventualbuddha</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://rspec.lighthouseapp.com/projects/5645/tickets/503</url>
      <milestone-title nil="true"></milestone-title>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">7315</assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body></body>
      <body-html></body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2008-11-28T17:34:15+01:00</created-at>
      <creator-id type="integer">24</creator-id>
      <diffable-attributes type="yaml">--- 
:assigned_user: 
:milestone: 8417
</diffable-attributes>
      <milestone-id type="integer">21779</milestone-id>
      <number type="integer">503</number>
      <permalink>rspec-fails-to-finish-running-properly-depending-on-load-order</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">5645</project-id>
      <state>resolved</state>
      <tag>bug patch</tag>
      <title>RSpec fails to finish running properly depending on load order</title>
      <updated-at type="datetime">2008-11-28T17:34:16+01:00</updated-at>
      <user-id type="integer">7315</user-id>
      <user-name>David Chelimsky</user-name>
      <creator-name>eventualbuddha</creator-name>
      <assigned-user-name>David Chelimsky</assigned-user-name>
      <url>http://rspec.lighthouseapp.com/projects/5645/tickets/503</url>
      <milestone-title>1.1.12</milestone-title>
    </version>
  </versions>
  <attachments type="array">
    <attachment type="Attachment">
      <code>b0e398a29ab547fb6bbeb4423423d493ca15cdb0</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2008-08-22T19:12:23+02:00</created-at>
      <filename>really_check_for_test_unit.patch</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">40989</id>
      <size type="integer">1707</size>
      <uploader-id type="integer">24</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://rspec.lighthouseapp.com/attachments/40989/really_check_for_test_unit.patch</url>
    </attachment>
  </attachments>
</ticket>
