[rspec-devel] [ rspec-Patches-11221 ] Autotest support does not work w/o Rails Gem installed

noreply at rubyforge.org noreply at rubyforge.org
Wed May 30 14:28:58 EDT 2007


Patches item #11221, was opened at 2007-05-30 07:47
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=11221&group_id=797

Category: rails plugin
Group: None
Status: Closed
Resolution: Accepted
Priority: 3
Submitted By: Josh Knowles (joshknowles)
Assigned to: David Chelimsky (dchelimsky)
Summary: Autotest support does not work w/o Rails Gem installed

Initial Comment:
Currently autotest support only works if you have the Rails gem installed due to a call to require 'active_support' in rails_spec.rb.  This causes problems for those of us who "vendor everything" and don't have any gems installed as ActiveSupport is not loaded until environment.rb is called.

Attached patch removes the call to require, which doesn't appear to even be used.

----------------------------------------------------------------------

Comment By: Jean-Michel Garnier (garnierjm)
Date: 2007-05-30 20:28

Message:
I have a project using rspec 1.0.4 + ZenTest 3.6.0 and rspec_on_rails + rspec installed in my vendor/plugins.

My list of gems is in http://rafb.net/p/212ywT51.html

This patch caused me the following failure:
$ autotest
loading autotest/rails_rspec
./vendor/plugins/rspec_on_rails/lib/autotest/rails_rspec.rb:33:in `initialize': undefined method `singularize' for ".svn/text-base/user":String (NoMethodError)
        from /usr/lib/ruby/gems/1.8/gems/ZenTest-3.6.0/lib/autotest.rb:395:in `tests_for_file'
        from ./vendor/plugins/rspec/lib/autotest/rspec.rb:19:in `tests_for_file'
        from /usr/lib/ruby/gems/1.8/gems/ZenTest-3.6.0/lib/autotest.rb:319:in `find_files_to_test'
        from /usr/lib/ruby/gems/1.8/gems/ZenTest-3.6.0/lib/autotest.rb:318:in `find_files_to_test'
        from /usr/lib/ruby/gems/1.8/gems/ZenTest-3.6.0/lib/autotest.rb:373:in `reset'
        from /usr/lib/ruby/gems/1.8/gems/ZenTest-3.6.0/lib/autotest.rb:164:in `run'
        from /usr/lib/ruby/gems/1.8/gems/ZenTest-3.6.0/lib/autotest.rb:123:in `run'
        from /usr/lib/ruby/gems/1.8/gems/ZenTest-3.6.0/bin/autotest:48
        from /usr/bin/autotest:16

 it could not find the method `singularize' in the following code:
 def initialize # :nodoc:
    super
    @spec_command = "script/spec"
    @exceptions = %r%^\./(?:coverage|db|doc|log|public|script|vendor\/rails|previous_failures.txt)%
    @test_mappings = {
      %r%^(test|spec)/fixtures/(.*).yml% => proc { |_, m|
        ["spec/models/#{m[2].singularize}_spec.rb"] + files_matching(%r%^spec\/views\/#{m[2]}/.*_spec\.rb$%)
      },

When I put back the require 'active_support', I got everything worked as a charm, including my hook defined in .autotest

The fact I have rails 1.2.1 installed in my gems might be the reason why it did work.

I'd love to write a spec for this bug but I haven't got enough exp with ruby & rspec ... 

Any thought?



----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-05-30 07:54

Message:
Applied to r2060.

Gotta love the one-liner patch. Thanks!

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=11221&group_id=797


More information about the rspec-devel mailing list