Thanks for your fast reply David,

> > The rake task requires spec/**/*.spec
>
> Close, but not quite. The default pattern is spec/**/*_spec.rb.
Typo sorry

>
> > Autotest rspec2 requires spec/**/*
>
> Again, this incorrect. Autotest fires off shell commands that include a list 
> of files to load based on a set of mappings: if file x changes, run a command 
> with file(s) y.
>
> In RSpec, those mappings are defined in Autotest::Rspec2, and they are set to 
> include files that end with _spec.rb, with some additional constraints based 
> on file naming conventions: a change to lib/foo/bar.rb tells RSpec to include 
> spec/foo/bar_spec.rb.
Yeah i saw that in the code. I just could not figure out why files
like:

spec/models/csv/shared_export_examples.rb

end up in the 'bundle exec /usr/bin/ruby1.8 -S /var/lib/gems/1.8/gems/
rspec-core-2.4.0/bin/rspec --tty'.... command line along with all the
_spec.rb files.

anohter thing that I don't quite understand is that even if i would
require this file again, why on earth ruby decides to require it if it
already was. For the example above, if I put

puts "-------------\n" + caller.join("\n")

i get two slightly different stacktraces:

-------------
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:235:in `load'
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:235:in `load'
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:227:in `load_dependency'
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:235:in `load'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/
configuration.rb:387:in `load_spec_files'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/
configuration.rb:387:in `map'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/
configuration.rb:387:in `load_spec_files'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:
18:in `run'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in
`run_in_process'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:46:in
`run'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:10
/var/lib/gems/1.8/gems/rspec-core-2.4.0/bin/rspec:4
-------------
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:239:in `require'
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:239:in `require'
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:227:in `load_dependency'
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:239:in `require'
/home/rob/dev/ws/wc-rubyapps/tafelmanager/spec/support/
require_relative.rb:2:in `require_relative'
/home/rob/dev/ws/wc-rubyapps/tafelmanager/spec/models/csv/
person_exporter_spec.rb:2
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:235:in `load'
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:235:in `load'
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:227:in `load_dependency'
/var/lib/gems/1.8/gems/activesupport-3.0.3/lib/active_support/
dependencies.rb:235:in `load'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/
configuration.rb:387:in `load_spec_files'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/
configuration.rb:387:in `map'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/
configuration.rb:387:in `load_spec_files'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:
18:in `run'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in
`run_in_process'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:46:in
`run'
/var/lib/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:10
/var/lib/gems/1.8/gems/rspec-core-2.4.0/bin/rspec:4

btw, just in case you wondered what require_relative means:
require_relative is:

def require_relative(file, requirement)
  require File.expand_path(File.join(File.dirname(file),requirement))
end

> I'm not sure where that's coming from, but it's not default settings of rspec 
> or autotest. What versions of rspec and autotest are you using? Is this a 
> rails app?

using:
Rails 3.0.3

bundle list yields (a.o.):
  * ZenTest (4.4.2)
  * autotest (4.4.6)
  * autotest-rails (4.1.0)
  * rspec (2.4.0)
  * rspec-core (2.4.0)
  * rspec-expectations (2.4.0)
  * rspec-mocks (2.4.0)
  * rspec-rails (2.4.1)

>
>
>
> > I presume that there is a way to configure autotests require set, but
> > i haven't found it yet.
>
> Autotest has a mapping mechanism that you can access in its initialize hook. 
> Seehttp://blog.davidchelimsky.net/2008/01/15/rspec-1-1-2-and-zentest-3-8-0/for
>  more on this.

Thanks - i'll try to add an exception for the shared.*examples.rb
files for now, while looking for the root cause these duplicated
requires.

>
> Cheers,
> David
> _______________________________________________
> rspec-users mailing list
> rspec-us...@rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to