Adam Anderson
2009-May-17 16:45 UTC
[rspec-users] Including extra directories for Autospec
Is there a way to tell autospec for rails to run _all_ the spec files in the spec directory a la spec/**/*_spec.rb instead of just the ones in model/controller/etc? I''ve experimented with adding my own mappings in <project_dir>/.autotest but haven''t had any luck.
David Chelimsky
2009-May-17 21:31 UTC
[rspec-users] Including extra directories for Autospec
On Sun, May 17, 2009 at 11:45 AM, Adam Anderson <adamandersonis at gmail.com> wrote:> Is there a way to tell autospec for rails to run _all_ the spec files > in the spec directory a la spec/**/*_spec.rb instead of just the ones > in model/controller/etc? I''ve experimented with adding my own mappings > in <project_dir>/.autotest but haven''t had any luck.See if this helps: http://blog.davidchelimsky.net/2008/01/15/rspec-1-1-2-and-zentest-3-8-0/
Adam Anderson
2009-May-17 23:24 UTC
[rspec-users] Including extra directories for Autospec
I''m really not sure what I''m doing wrong so I tried started from scratch still with no positive results. Here''s my setup: rails 2.3.2 rspec 1.2.6 rspec-rails 1.2.6 ZenTest 4.0.0 Here''s what I did: $ rails foo $ cd foo $ ./script/generate rspec $ ./script/generate rspec_model Bar $ rake db:migrate RAILS_ENV=test $ autospec # => runs and passes one example $ mkdir spec/something $ touch ./autotest spec/something/lol_spec.rb $ autospec -v # => correctly does not find a mapping for spec/something/lol_spec.rb Then I edit the files like so: ./autotest: Autotest.add_hook :initialize do |at| at.add_mapping(%r%^spec/something/.*_spec\.rb$%) do at.files_matching(%r%^spec/something/.*_spec\.rb$%) end end spec/something/lol_spec.rb: describe "Lol" do it "should do a thing" do false.should be_true end end $ autospec -v # => still not finding a match for spec/something/lol_spec.rb loading autotest/rails_rspec No tests matched app/helpers/application_helper.rb No tests matched spec/rcov.opts No tests matched test/test_helper.rb No tests matched lib/tasks/rspec.rake No tests matched Rakefile No tests matched README No tests matched .autotest No tests matched spec/something/lol_spec.rb No tests matched test/performance/browsing_test.rb No tests matched spec/spec.opts /opt/local/bin/ruby /opt/local/lib/ruby/gems/1.8/gems/rspec-1.2.6/bin/spec --autospec spec/models/bar_spec.rb -O spec/spec.opts . Finished in 0.135414 seconds 1 example, 0 failures # Waiting since 2009-05-17 16:22:56 Sorry to be so verbose but I''m honestly very lost at this point... I''ve also tried variations of this the add_mapping method by using the block variables but no go. -Adam On Sun, May 17, 2009 at 2:31 PM, David Chelimsky <dchelimsky at gmail.com> wrote:> On Sun, May 17, 2009 at 11:45 AM, Adam Anderson > <adamandersonis at gmail.com> wrote: >> Is there a way to tell autospec for rails to run _all_ the spec files >> in the spec directory a la spec/**/*_spec.rb instead of just the ones >> in model/controller/etc? I''ve experimented with adding my own mappings >> in <project_dir>/.autotest but haven''t had any luck. > > See if this helps: > http://blog.davidchelimsky.net/2008/01/15/rspec-1-1-2-and-zentest-3-8-0/ > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Kero van Gelder
2009-May-18 18:55 UTC
[rspec-users] Including extra directories for Autospec
> Then I edit the files like so: > > ./autotest: > Autotest.add_hook :initialize do |at| > at.add_mapping(%r%^spec/something/.*_spec\.rb$%) do > at.files_matching(%r%^spec/something/.*_spec\.rb$%) > end > endDo you perhaps have a ~/.autotest with a hook to :initialize ? If so, let it return nil, like this: Autotest.add_hook :initialize do |at| %w{.svn .hg .git}.each {|exception| at.add_exception(exception) } nil end It''s documented, but a nasty default behaviour. Bye, Kero. ___ How can I change the world if I can''t even change myself? -- Faithless, Salva Mea
Adam Anderson
2009-May-19 05:54 UTC
[rspec-users] Including extra directories for Autospec
Yeah. I apologize that was a typo on my part. It should have said ./.autotest -Adam On Mon, May 18, 2009 at 11:55 AM, Kero van Gelder <kero at chello.nl> wrote:>> Then I edit the files like so: >> >> ./autotest: >> Autotest.add_hook :initialize do |at| >> ? at.add_mapping(%r%^spec/something/.*_spec\.rb$%) do >> ? ? at.files_matching(%r%^spec/something/.*_spec\.rb$%) >> ? end >> end > > Do you perhaps have a ~/.autotest with a hook to :initialize ? > If so, let it return nil, like this: > > Autotest.add_hook :initialize do |at| > ?%w{.svn .hg .git}.each {|exception| > ? ?at.add_exception(exception) > ?} > ?nil > end > > > It''s documented, but a nasty default behaviour. > > Bye, > Kero. > > ___ > How can I change the world if I can''t even change myself? > ?-- Faithless, Salva Mea > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky
2009-May-27 08:31 UTC
[rspec-users] Including extra directories for Autospec
Adam, that''s not what Kero was asking about. In addition to the ./.autotest file, do you also have a ~/.autotest file? On Tue, May 19, 2009 at 1:54 AM, Adam Anderson <adamandersonis at gmail.com> wrote:> Yeah. I apologize that was a typo on my part. It should have said ./.autotest > > > -Adam > > On Mon, May 18, 2009 at 11:55 AM, Kero van Gelder <kero at chello.nl> wrote: >>> Then I edit the files like so: >>> >>> ./autotest: >>> Autotest.add_hook :initialize do |at| >>> ? at.add_mapping(%r%^spec/something/.*_spec\.rb$%) do >>> ? ? at.files_matching(%r%^spec/something/.*_spec\.rb$%) >>> ? end >>> end >> >> Do you perhaps have a ~/.autotest with a hook to :initialize ? >> If so, let it return nil, like this: >> >> Autotest.add_hook :initialize do |at| >> ?%w{.svn .hg .git}.each {|exception| >> ? ?at.add_exception(exception) >> ?} >> ?nil >> end >> >> >> It''s documented, but a nasty default behaviour. >> >> Bye, >> Kero. >> >> ___ >> How can I change the world if I can''t even change myself? >> ?-- Faithless, Salva Mea >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >