Matt Aimonetti
2007-Apr-13 06:31 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
Josh Knowles http://joshknowles.com/ just let me know that ZenTest Autotest 3.50 now handles your RSpec specs. http://blog.zenspider.com/archives/2007/04/zentest_version_350_has_been_released.html That''s a great news. Josh also shared with me a quick hack to make autotest work with only the RSpec plugin installed. Add the following into your ~/.autotest file http://pastie.caboo.se/53535 Autotest.add_hook :initialize do |autotest| if autotest.is_a? RspecRailsAutotest autotest.spec_command = ''script/spec --options spec/spec.opts'' if File.exist? ''script/spec'' end end -Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070412/33a787f2/attachment.html
On 4/13/07, Matt Aimonetti <matttemp at gmail.com> wrote:> > Josh Knowles http://joshknowles.com/ just let me know that ZenTest Autotest > 3.50 now handles your RSpec specs. > > http://blog.zenspider.com/archives/2007/04/zentest_version_350_has_been_released.html > > That''s a great news.That''s awesome, I had no idea Ryan was even planning to do anything with it. David and I were conversing about putting it in RSpec proper, because I hadn''t heard anything. No need now! /Nick
"Nick Sieger" <nicksieger at gmail.com> writes:> On 4/13/07, Matt Aimonetti <matttemp at gmail.com> wrote: >> >> Josh Knowles http://joshknowles.com/ just let me know that ZenTest Autotest >> 3.50 now handles your RSpec specs. >> >> http://blog.zenspider.com/archives/2007/04/zentest_version_350_has_been_released.html >> >> That''s a great news. > > That''s awesome, I had no idea Ryan was even planning to do anything > with it. David and I were conversing about putting it in RSpec > proper, because I hadn''t heard anything. No need now!The one in ZenTest is only the Rails version, not the standalone one also. - bob> > /Nick > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
David Chelimsky
2007-Apr-13 22:22 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
On 4/13/07, Nick Sieger <nicksieger at gmail.com> wrote:> On 4/13/07, Matt Aimonetti <matttemp at gmail.com> wrote: > > > > Josh Knowles http://joshknowles.com/ just let me know that ZenTest Autotest > > 3.50 now handles your RSpec specs. > > > > http://blog.zenspider.com/archives/2007/04/zentest_version_350_has_been_released.html > > > > That''s a great news. > > That''s awesome, I had no idea Ryan was even planning to do anything > with it. David and I were conversing about putting it in RSpec > proper, because I hadn''t heard anything. No need now!Well, there might be a need. There are some things that have already changed in RSpec 0.9 that cause this to not work properly (there is no longer a -s option, for example), and not all of the dirs for rails are accounted for (it doesn''t pay attention to the view spec directories, for example). I''ll see if I can work w/ Ryan to come up w/ a good separation of responsibilities for what should stay in ZenTest and what should be defined directly in RSpec. David> > /Nick > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
I''m actually pretty close to finishing Autospec - a port of autotest to RSpec (although for the time being it only works for standalone projects). I should probably be done with this standalone version in a week or so. Scott On Apr 13, 2007, at 6:22 PM, David Chelimsky wrote:> On 4/13/07, Nick Sieger <nicksieger at gmail.com> wrote: >> On 4/13/07, Matt Aimonetti <matttemp at gmail.com> wrote: >>> >>> Josh Knowles http://joshknowles.com/ just let me know that >>> ZenTest Autotest >>> 3.50 now handles your RSpec specs. >>> >>> http://blog.zenspider.com/archives/2007/04/ >>> zentest_version_350_has_been_released.html >>> >>> That''s a great news. >> >> That''s awesome, I had no idea Ryan was even planning to do anything >> with it. David and I were conversing about putting it in RSpec >> proper, because I hadn''t heard anything. No need now! > > Well, there might be a need. There are some things that have already > changed in RSpec 0.9 that cause this to not work properly (there is no > longer a -s option, for example), and not all of the dirs for rails > are accounted for (it doesn''t pay attention to the view spec > directories, for example). I''ll see if I can work w/ Ryan to come up > w/ a good separation of responsibilities for what should stay in > ZenTest and what should be defined directly in RSpec. > > David > >> >> /Nick >> _______________________________________________ >> 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
On 4/13/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:> > > I''m actually pretty close to finishing Autospec - a port of autotest > to RSpec (although for the time being it only works for standalone > projects). I should probably be done with this standalone version in > a week or so.While I definitely appreciate you taking the time to add standalone spec support, is there any reason you are forking this as opposed to just submitting a patch to Ryan? He has put in quite a bit of effort in the extensibility of Autotest, I''d hate to see that forked. -- Josh Knowles joshknowles at gmail.com http://joshknowles.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070413/a7b94f0c/attachment-0001.html
David Chelimsky
2007-Apr-14 04:59 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
On 4/13/07, Josh Knowles <joshknowles at gmail.com> wrote:> > > On 4/13/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > > > > I''m actually pretty close to finishing Autospec - a port of autotest > > to RSpec (although for the time being it only works for standalone > > projects). I should probably be done with this standalone version in > > a week or so. > > While I definitely appreciate you taking the time to add standalone spec > support, is there any reason you are forking this as opposed to just > submitting a patch to Ryan? He has put in quite a bit of effort in the > extensibility of Autotest, I''d hate to see that forked.I agree that we should extend rather than replace. The trick is to figure out what belongs in Autotest and what belongs in RSpec. It seems to me that everything related to specific commands and directories should live in RSpec and pretty much everything else belongs in ZenTest. I haven''t had time to look to see if this is already doable but it might be. I''ll take a peek this coming week. David> > > -- > Josh Knowles > joshknowles at gmail.com > http://joshknowles.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
For some reason, I''m completely blanking on how to do this... Sorry for the lots-o-code example. What I''m trying to do: stub the validate_login method in application_controller so it returns true (user is logged in). What happens: validate_login method in application_controller.rb is called instead of my stub. What I''m struggling with is the syntax to make the stub override the protected method in the parent class. Thanks, application.rb def requires_authorization render(:template => ''shared/login'') unless validate_login end protected def validate_login return false if session[:user].blank? || session[:user] != LOGIN_USER_NAME # oversimplification, be gentle return true end admin_controller.rb class AdminController < ApplicationController before_filter :requires_authorization def index end end admin_controller_spec.rb describe "an AdminController should" do controller_name :admin integrate_views it "should grant access to users who are logged in" do stub!(:validate_login).and_return(true) # also tried ApplicationController.stub! (:validate_login).and_return(true). Same result. get :index response.should be_success puts response.body response.should have_tag(''h1'', ''Administer Site'') end end
On 4/15/07, s.ross <cwdinfo at gmail.com> wrote:> For some reason, I''m completely blanking on how to do this... Sorry > for the lots-o-code example. > > What I''m trying to do: stub the validate_login method in > application_controller so it returns true (user is logged in). > What happens: validate_login method in application_controller.rb is > called instead of my stub.In your setup (or wherever), do controller.stub!(:validate_login).and_return true When you called stub! without an explicit receiver, the message gets sent to self, which is a context. Then when you called stub! on ApplicationController, it created a class-level method. In Rails, each request creates a new controller instance, so you need to call stub! on that instance. Pat
That was the magic. controller. As it turns out, this doesn''t have to happen in setup, so I can specify both the positive and negative specification in one describe, as: describe "an AdminController login process" do controller_name :admin integrate_views it "should deny access if you aren''t logged in" do # stuff to determine that user gets a login page end it "should permit access if you are logged in" do controller.stub!(:validate_login).and_return(true) # stuff to determine success end end Is there a benefit to using two describe blocks, one with a setup/ stub! and the other without? Steve On Apr 15, 2007, at 11:22 AM, Pat Maddox wrote:> On 4/15/07, s.ross <cwdinfo at gmail.com> wrote: >> For some reason, I''m completely blanking on how to do this... Sorry >> for the lots-o-code example. >> >> What I''m trying to do: stub the validate_login method in >> application_controller so it returns true (user is logged in). >> What happens: validate_login method in application_controller.rb is >> called instead of my stub. > > In your setup (or wherever), do > > controller.stub!(:validate_login).and_return true > > When you called stub! without an explicit receiver, the message gets > sent to self, which is a context. Then when you called stub! on > ApplicationController, it created a class-level method. In Rails, > each request creates a new controller instance, so you need to call > stub! on that instance. > > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Are there tests for Autotest itself? I can''t seem to find any. Scott On Apr 13, 2007, at 8:09 PM, Josh Knowles wrote:> > > On 4/13/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > I''m actually pretty close to finishing Autospec - a port of autotest > to RSpec (although for the time being it only works for standalone > projects). I should probably be done with this standalone version in > a week or so. > > While I definitely appreciate you taking the time to add standalone > spec support, is there any reason you are forking this as opposed > to just submitting a patch to Ryan? He has put in quite a bit of > effort in the extensibility of Autotest, I''d hate to see that forked. > > > -- > Josh Knowles > joshknowles at gmail.com > http://joshknowles.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Yes, I guess there are tests. I''ll look into doing this... Scott On Apr 13, 2007, at 8:09 PM, Josh Knowles wrote:> > > On 4/13/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > I''m actually pretty close to finishing Autospec - a port of autotest > to RSpec (although for the time being it only works for standalone > projects). I should probably be done with this standalone version in > a week or so. > > While I definitely appreciate you taking the time to add standalone > spec support, is there any reason you are forking this as opposed > to just submitting a patch to Ryan? He has put in quite a bit of > effort in the extensibility of Autotest, I''d hate to see that forked. > > > -- > Josh Knowles > joshknowles at gmail.com > http://joshknowles.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Matt Aimonetti
2007-Apr-17 07:16 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
Anyone knows how to get autotest to check on a plugin spec? I''m working on a plugin and I would love to use autotest to check on my specs. On a different note, RSpec has a nice rake command: rake spec:plugins but I wish I could do rake spec:plugins PLUGIN=my_plugin and only run the specs ofor my plugin. (I had issues with other plugins crashing the test before it would reach my plugin :( ) Thanks Matt On 4/16/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:> > > Yes, I guess there are tests. > > I''ll look into doing this... > > Scott > > > On Apr 13, 2007, at 8:09 PM, Josh Knowles wrote: > > > > > > > On 4/13/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > > I''m actually pretty close to finishing Autospec - a port of autotest > > to RSpec (although for the time being it only works for standalone > > projects). I should probably be done with this standalone version in > > a week or so. > > > > While I definitely appreciate you taking the time to add standalone > > spec support, is there any reason you are forking this as opposed > > to just submitting a patch to Ryan? He has put in quite a bit of > > effort in the extensibility of Autotest, I''d hate to see that forked. > > > > > > -- > > Josh Knowles > > joshknowles at gmail.com > > http://joshknowles.com > > _______________________________________________ > > 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070417/d8be2f74/attachment.html
David Chelimsky
2007-Apr-17 07:23 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
On 4/17/07, Matt Aimonetti <matttemp at gmail.com> wrote:> Anyone knows how to get autotest to check on a plugin spec? I''m working on a > plugin and I would love to use autotest to check on my specs. > > On a different note, RSpec has a nice rake command: rake spec:plugins but I > wish I could do rake spec:plugins PLUGIN=my_plugin and only run the specs > ofor my plugin. (I had issues with other plugins crashing the test before it > would reach my plugin :( )Just add this to your own spec file: desc "Run my plugin''s specs" Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t| t.spec_opts = [''--options'', "\"#{RAILS_ROOT}/spec/spec.opts\""] t.spec_files = FileList[''vendor/plugins/my_plugin/spec/**/*_spec.rb''] end> > Thanks > > Matt > > > > > > > On 4/16/07, Scott Taylor <mailing_lists at railsnewbie.com > wrote: > > > > Yes, I guess there are tests. > > > > I''ll look into doing this... > > > > Scott > > > > > > On Apr 13, 2007, at 8:09 PM, Josh Knowles wrote: > > > > > > > > > > > On 4/13/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > > > I''m actually pretty close to finishing Autospec - a port of autotest > > > to RSpec (although for the time being it only works for standalone > > > projects). I should probably be done with this standalone version in > > > a week or so. > > > > > > While I definitely appreciate you taking the time to add standalone > > > spec support, is there any reason you are forking this as opposed > > > to just submitting a patch to Ryan? He has put in quite a bit of > > > effort in the extensibility of Autotest, I''d hate to see that forked. > > > > > > > > > -- > > > Josh Knowles > > > joshknowles at gmail.com > > > http://joshknowles.com > > > _______________________________________________ > > > 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 > > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky
2007-Apr-17 07:23 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
On 4/17/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 4/17/07, Matt Aimonetti <matttemp at gmail.com> wrote: > > Anyone knows how to get autotest to check on a plugin spec? I''m working on a > > plugin and I would love to use autotest to check on my specs. > > > > On a different note, RSpec has a nice rake command: rake spec:plugins but I > > wish I could do rake spec:plugins PLUGIN=my_plugin and only run the specs > > ofor my plugin. (I had issues with other plugins crashing the test before it > > would reach my plugin :( ) > > Just add this to your own spec file: > > desc "Run my plugin''s specs" > Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t| > t.spec_opts = [''--options'', "\"#{RAILS_ROOT}/spec/spec.opts\""] > t.spec_files = FileList[''vendor/plugins/my_plugin/spec/**/*_spec.rb''] > endBut with :my_plugin: desc "Run my plugin''s specs" Spec::Rake::SpecTask.new(:my_plugin => spec_prereq) do |t| t.spec_opts = [''--options'', "\"#{RAILS_ROOT}/spec/spec.opts\""] t.spec_files = FileList[''vendor/plugins/my_plugin/spec/**/*_spec.rb''] end> > > > > > > Thanks > > > > Matt > > > > > > > > > > > > > > On 4/16/07, Scott Taylor <mailing_lists at railsnewbie.com > wrote: > > > > > > Yes, I guess there are tests. > > > > > > I''ll look into doing this... > > > > > > Scott > > > > > > > > > On Apr 13, 2007, at 8:09 PM, Josh Knowles wrote: > > > > > > > > > > > > > > > On 4/13/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > > > > I''m actually pretty close to finishing Autospec - a port of autotest > > > > to RSpec (although for the time being it only works for standalone > > > > projects). I should probably be done with this standalone version in > > > > a week or so. > > > > > > > > While I definitely appreciate you taking the time to add standalone > > > > spec support, is there any reason you are forking this as opposed > > > > to just submitting a patch to Ryan? He has put in quite a bit of > > > > effort in the extensibility of Autotest, I''d hate to see that forked. > > > > > > > > > > > > -- > > > > Josh Knowles > > > > joshknowles at gmail.com > > > > http://joshknowles.com > > > > _______________________________________________ > > > > 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 > > > > > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > >
David Chelimsky
2007-Apr-17 07:24 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
On 4/17/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 4/17/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > On 4/17/07, Matt Aimonetti <matttemp at gmail.com> wrote: > > > Anyone knows how to get autotest to check on a plugin spec? I''m working on a > > > plugin and I would love to use autotest to check on my specs. > > > > > > On a different note, RSpec has a nice rake command: rake spec:plugins but I > > > wish I could do rake spec:plugins PLUGIN=my_plugin and only run the specs > > > ofor my plugin. (I had issues with other plugins crashing the test before it > > > would reach my plugin :( ) > > > > Just add this to your own spec file: > > > > desc "Run my plugin''s specs" > > Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t| > > t.spec_opts = [''--options'', "\"#{RAILS_ROOT}/spec/spec.opts\""] > > t.spec_files = FileList[''vendor/plugins/my_plugin/spec/**/*_spec.rb''] > > end > > But with :my_plugin: > > desc "Run my plugin''s specs" > Spec::Rake::SpecTask.new(:my_plugin => spec_prereq) do |t| > t.spec_opts = [''--options'', "\"#{RAILS_ROOT}/spec/spec.opts\""] > t.spec_files = FileList[''vendor/plugins/my_plugin/spec/**/*_spec.rb''] > end >D''oh! Your RAKE file. Starting over.... Just add this to your own rake file: desc "Run my plugin''s specs" Spec::Rake::SpecTask.new(:my_plugin => spec_prereq) do |t| t.spec_opts = [''--options'', "\"#{RAILS_ROOT}/spec/spec.opts\""] t.spec_files = FileList[''vendor/plugins/my_plugin/spec/**/*_spec.rb''] end> > > > > > > > > > > > Thanks > > > > > > Matt > > > > > > > > > > > > > > > > > > > > > On 4/16/07, Scott Taylor <mailing_lists at railsnewbie.com > wrote: > > > > > > > > Yes, I guess there are tests. > > > > > > > > I''ll look into doing this... > > > > > > > > Scott > > > > > > > > > > > > On Apr 13, 2007, at 8:09 PM, Josh Knowles wrote: > > > > > > > > > > > > > > > > > > > On 4/13/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > > > > > I''m actually pretty close to finishing Autospec - a port of autotest > > > > > to RSpec (although for the time being it only works for standalone > > > > > projects). I should probably be done with this standalone version in > > > > > a week or so. > > > > > > > > > > While I definitely appreciate you taking the time to add standalone > > > > > spec support, is there any reason you are forking this as opposed > > > > > to just submitting a patch to Ryan? He has put in quite a bit of > > > > > effort in the extensibility of Autotest, I''d hate to see that forked. > > > > > > > > > > > > > > > -- > > > > > Josh Knowles > > > > > joshknowles at gmail.com > > > > > http://joshknowles.com > > > > > _______________________________________________ > > > > > 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 > > > > > > > > > > > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > >
On 4/13/07, Matt Aimonetti <matttemp at gmail.com> wrote:> > Josh Knowles http://joshknowles.com/ just let me know that ZenTest Autotest > 3.50 now handles your RSpec specs.It seems that autotest assumes you are using integrated views specs. I''ve changed my rspec_rails_autotest.rb accordingly to run view specs automatically: # when %r%^app/views/layouts/(.*)\.rhtml% then # ["spec/views/layouts/#{$1}_spec.rb"] when %r%^app/views/(.*)\.rhtml$% then ["spec/views/#{$1}_view_spec.rb"] /Marcus
On 4/17/07, Marcus Ahnve <marcus at ahnve.com> wrote:> On 4/13/07, Matt Aimonetti <matttemp at gmail.com> wrote: > > > > Josh Knowles http://joshknowles.com/ just let me know that ZenTest Autotest > > 3.50 now handles your RSpec specs. > > It seems that autotest assumes you are using integrated views specs. > > I''ve changed my rspec_rails_autotest.rb accordingly to run view specs > automatically: > > # when %r%^app/views/layouts/(.*)\.rhtml% then > # ["spec/views/layouts/#{$1}_spec.rb"] > when %r%^app/views/(.*)\.rhtml$% then > ["spec/views/#{$1}_view_spec.rb"] >Yeah, this is reasonable -- when I first wrote the code I more or less ported the autotest for Rails, before RSpec had standalone view testing. It''s not clear to me right now how to allow rspec/autotest to be customized depending on whether you do standalone or integrated views, to ensure that the right specs get run, other than to make the change you make here. /Nick
Matt Aimonetti
2007-Apr-17 22:48 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
Thanks, but I still have the issue of adding my plugin to be scanned by autotest. (Nick, is there anyway we could add more files to be scanned?) The other issue I''m facing is that my view specs are not checked by autotest. My view specs are in /spec/views/[controller name]/[view_name]_spec.rb I understand this is not related directly to RSpec but is you use RSpec and you want to use AutoTest you will face the same issue. Thanks, Matt On 4/17/07, Nick Sieger <nicksieger at gmail.com> wrote:> > On 4/17/07, Marcus Ahnve <marcus at ahnve.com> wrote: > > On 4/13/07, Matt Aimonetti <matttemp at gmail.com> wrote: > > > > > > Josh Knowles http://joshknowles.com/ just let me know that ZenTest > Autotest > > > 3.50 now handles your RSpec specs. > > > > It seems that autotest assumes you are using integrated views specs. > > > > I''ve changed my rspec_rails_autotest.rb accordingly to run view specs > > automatically: > > > > # when %r%^app/views/layouts/(.*)\.rhtml% then > > # ["spec/views/layouts/#{$1}_spec.rb"] > > when %r%^app/views/(.*)\.rhtml$% then > > ["spec/views/#{$1}_view_spec.rb"] > > > > Yeah, this is reasonable -- when I first wrote the code I more or less > ported the autotest for Rails, before RSpec had standalone view > testing. It''s not clear to me right now how to allow rspec/autotest > to be customized depending on whether you do standalone or integrated > views, to ensure that the right specs get run, other than to make the > change you make here. > > /Nick > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070417/24d5bf88/attachment-0001.html
Matt Aimonetti
2007-Apr-17 23:55 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
Nick, maybe you can help. I modified the tests_for_file function in rspecrails_autotest.rb and I simply added def tests_for_file(filename) case filename when %r%^spec/fixtures/(.*)s.yml% then ["spec/models/#{$1}_spec.rb", "spec/controllers/#{$1}_controller_spec.rb"] when %r%^spec/models/.*rb$% then [filename] when %r%^spec/controllers/.*\.rb$% then [filename] when %r%^spec/views/([^/]*)/.*\.rb$% then [filename] # when %r%^spec/acceptance/.*\.rb$% then # [filename] It now loads all my view specs, what should I do to get that added to the next release of autotest for RSpec? Matt P.s: I wish there was a hook to add more files to test such as my plugin specs ;) On 4/17/07, Matt Aimonetti <matttemp at gmail.com> wrote:> > Thanks, but I still have the issue of adding my plugin to be scanned by > autotest. (Nick, is there anyway we could add more files to be scanned?) > > The other issue I''m facing is that my view specs are not checked by > autotest. My view specs are in /spec/views/[controller > name]/[view_name]_spec.rb > > I understand this is not related directly to RSpec but is you use RSpec > and you want to use AutoTest you will face the same issue. > > Thanks, > > Matt > > > On 4/17/07, Nick Sieger <nicksieger at gmail.com> wrote: > > > > On 4/17/07, Marcus Ahnve <marcus at ahnve.com> wrote: > > > On 4/13/07, Matt Aimonetti <matttemp at gmail.com> wrote: > > > > > > > > Josh Knowles http://joshknowles.com/ just let me know that ZenTest > > Autotest > > > > 3.50 now handles your RSpec specs. > > > > > > It seems that autotest assumes you are using integrated views specs. > > > > > > I''ve changed my rspec_rails_autotest.rb accordingly to run view specs > > > automatically: > > > > > > # when %r%^app/views/layouts/(.*)\.rhtml% then > > > # ["spec/views/layouts/#{$1}_spec.rb"] > > > when %r%^app/views/(.*)\.rhtml$% then > > > ["spec/views/#{$1}_view_spec.rb"] > > > > > > > Yeah, this is reasonable -- when I first wrote the code I more or less > > ported the autotest for Rails, before RSpec had standalone view > > testing. It''s not clear to me right now how to allow rspec/autotest > > to be customized depending on whether you do standalone or integrated > > views, to ensure that the right specs get run, other than to make the > > change you make here. > > > > /Nick > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070417/3feae0c6/attachment.html
David Chelimsky
2007-Apr-18 00:27 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
On 4/17/07, Matt Aimonetti <matttemp at gmail.com> wrote:> > Nick, maybe you can help. I modified the tests_for_file function in > rspecrails_autotest.rb and I simply added > > def tests_for_file(filename) > case filename > when %r%^spec/fixtures/(.*)s.yml% then > ["spec/models/#{$1}_spec.rb", > "spec/controllers/#{$1}_controller_spec.rb"] > when %r%^spec/models/.*rb$% then > [filename] > when %r%^spec/controllers/.*\.rb$% then > [filename] > when %r%^spec/views/([^/]*)/.*\.rb$% then > [filename] > # when %r%^spec/acceptance/.*\.rb$% then > # [filename] > > It now loads all my view specs, what should I do to get that added to the > next release of autotest for RSpec? > > Matt > > P.s: I wish there was a hook to add more files to test such as my plugin > specs ;)If you''re patching rspec autotest, why not just add your hook. You could make a hash of regexps to related files that you can add to through a class method. David> > > > On 4/17/07, Matt Aimonetti <matttemp at gmail.com> wrote: > > Thanks, but I still have the issue of adding my plugin to be scanned by > autotest. (Nick, is there anyway we could add more files to be scanned?) > > > > The other issue I''m facing is that my view specs are not checked by > autotest. My view specs are in /spec/views/[controller > name]/[view_name]_spec.rb > > > > I understand this is not related directly to RSpec but is you use RSpec > and you want to use AutoTest you will face the same issue. > > > > Thanks, > > > > Matt > > > > > > > > > > On 4/17/07, Nick Sieger <nicksieger at gmail.com> wrote: > > > On 4/17/07, Marcus Ahnve <marcus at ahnve.com> wrote: > > > > On 4/13/07, Matt Aimonetti < matttemp at gmail.com> wrote: > > > > > > > > > > Josh Knowles http://joshknowles.com/ just let me know that ZenTest > Autotest > > > > > 3.50 now handles your RSpec specs. > > > > > > > > It seems that autotest assumes you are using integrated views specs. > > > > > > > > I''ve changed my rspec_rails_autotest.rb accordingly to run view specs > > > > automatically: > > > > > > > > # when %r%^app/views/layouts/(.*)\.rhtml% then > > > > # ["spec/views/layouts/#{$1}_spec.rb"] > > > > when %r%^app/views/(.*)\.rhtml$% then > > > > ["spec/views/#{$1}_view_spec.rb"] > > > > > > > > > > Yeah, this is reasonable -- when I first wrote the code I more or less > > > ported the autotest for Rails, before RSpec had standalone view > > > testing. It''s not clear to me right now how to allow rspec/autotest > > > to be customized depending on whether you do standalone or integrated > > > views, to ensure that the right specs get run, other than to make the > > > change you make here. > > > > > > /Nick > > > _______________________________________________ > > > 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 >
Matt Aimonetti
2007-Apr-18 15:46 UTC
[rspec-users] ZenTest autotest now handles RSpec, yay!
I really like the idea of a hook to add your own regexps. Also, it would be nice to remove the vendor folder from the scan exceptions. class RspecRailsAutotest < Autotest attr_accessor :spec_command def initialize # :nodoc: @spec_command = "spec --diff unified" super @exceptions = %r%^\./(?:coverage|db|doc|log|public|script|vendor)% end Thanks -Matt On 4/17/07, David Chelimsky <dchelimsky at gmail.com> wrote:> > On 4/17/07, Matt Aimonetti <matttemp at gmail.com> wrote: > > > > Nick, maybe you can help. I modified the tests_for_file function in > > rspecrails_autotest.rb and I simply added > > > > def tests_for_file(filename) > > case filename > > when %r%^spec/fixtures/(.*)s.yml% then > > ["spec/models/#{$1}_spec.rb", > > "spec/controllers/#{$1}_controller_spec.rb"] > > when %r%^spec/models/.*rb$% then > > [filename] > > when %r%^spec/controllers/.*\.rb$% then > > [filename] > > when %r%^spec/views/([^/]*)/.*\.rb$% then > > [filename] > > # when %r%^spec/acceptance/.*\.rb$% then > > # [filename] > > > > It now loads all my view specs, what should I do to get that added to > the > > next release of autotest for RSpec? > > > > Matt > > > > P.s: I wish there was a hook to add more files to test such as my plugin > > specs ;) > > If you''re patching rspec autotest, why not just add your hook. You > could make a hash of regexps to related files that you can add to > through a class method. > > David > > > > > > > > > On 4/17/07, Matt Aimonetti <matttemp at gmail.com> wrote: > > > Thanks, but I still have the issue of adding my plugin to be scanned > by > > autotest. (Nick, is there anyway we could add more files to be scanned?) > > > > > > The other issue I''m facing is that my view specs are not checked by > > autotest. My view specs are in /spec/views/[controller > > name]/[view_name]_spec.rb > > > > > > I understand this is not related directly to RSpec but is you use > RSpec > > and you want to use AutoTest you will face the same issue. > > > > > > Thanks, > > > > > > Matt > > > > > > > > > > > > > > > On 4/17/07, Nick Sieger <nicksieger at gmail.com> wrote: > > > > On 4/17/07, Marcus Ahnve <marcus at ahnve.com> wrote: > > > > > On 4/13/07, Matt Aimonetti < matttemp at gmail.com> wrote: > > > > > > > > > > > > Josh Knowles http://joshknowles.com/ just let me know that > ZenTest > > Autotest > > > > > > 3.50 now handles your RSpec specs. > > > > > > > > > > It seems that autotest assumes you are using integrated views > specs. > > > > > > > > > > I''ve changed my rspec_rails_autotest.rb accordingly to run view > specs > > > > > automatically: > > > > > > > > > > # when %r%^app/views/layouts/(.*)\.rhtml% then > > > > > # ["spec/views/layouts/#{$1}_spec.rb"] > > > > > when %r%^app/views/(.*)\.rhtml$% then > > > > > ["spec/views/#{$1}_view_spec.rb"] > > > > > > > > > > > > > Yeah, this is reasonable -- when I first wrote the code I more or > less > > > > ported the autotest for Rails, before RSpec had standalone view > > > > testing. It''s not clear to me right now how to allow rspec/autotest > > > > to be customized depending on whether you do standalone or > integrated > > > > views, to ensure that the right specs get run, other than to make > the > > > > change you make here. > > > > > > > > /Nick > > > > _______________________________________________ > > > > 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 > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070418/65b4d1a5/attachment.html