Is anyone using rspec with autotest? Scott
Hi Scott - I haven''t used autotest with rspec, but a friend has... http://www.robbyonrails.com/articles/tag/autotest Thanks, graeme On Mar 27, 2007, at 11:46 PM, Scott Taylor wrote:> > Is anyone using rspec with autotest? > > Scott > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On 3/28/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:> > Is anyone using rspec with autotest?I''ve been using http://svn.caldersphere.net/svn/main/plugins/rspec_autotest with great success.> > Scott > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Mar 28, 2007, at 6:48 AM, David Chelimsky wrote:> On 3/28/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: >> >> Is anyone using rspec with autotest? > > I''ve been using > http://svn.caldersphere.net/svn/main/plugins/rspec_autotest with great > success. >Same here. Works well. The task will not show in your rake -T listing because of a missing desc line. Just add something like the following: desc "Autotest that works with RSpec" to the rake file in the tasks directory for the plugin. Michael railsconsulting.com
I added this to my rakefile, to handle clearing out the test database / getting it up to date migrations in the dev. database. namespace :spec do task :server => ''db:test:prepare'' do system(''script/rails_spec_server'') end end Autotest is the bomb. I blogged a shortcut that I didn''t come up with myself. But it is certainly useful to be able to scope your autotest runs to a subset of your project. http://jchris.mfdz.com/code/2007/2/scope_autotest_by_filename Chris On 3/28/07, Michael Trier <mtrier at eminentconsultinggroup.com> wrote:> > On Mar 28, 2007, at 6:48 AM, David Chelimsky wrote: > > > On 3/28/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > >> > >> Is anyone using rspec with autotest? > > > > I''ve been using > > http://svn.caldersphere.net/svn/main/plugins/rspec_autotest with great > > success. > > > > Same here. Works well. The task will not show in your rake -T > listing because of a missing desc line. Just add something like the > following: > > desc "Autotest that works with RSpec" > > to the rake file in the tasks directory for the plugin. > > Michael > railsconsulting.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Chris Anderson http://jchris.mfdz.com
What do you think about adding this code to rspec? Or does it more properly belong with autotest or as a plugin? I''ve noticed that it won''t work with a) color and b) with a checked out rspec directory w/ rails. That means all of my describe it spec''s won''t work, and the spec''s won''t even run. I''ve patched part b) for my own use. Would this be helpful to anyone? Scott On Mar 28, 2007, at 9:17 AM, Michael Trier wrote:> > On Mar 28, 2007, at 6:48 AM, David Chelimsky wrote: > >> On 3/28/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: >>> >>> Is anyone using rspec with autotest? >> >> I''ve been using >> http://svn.caldersphere.net/svn/main/plugins/rspec_autotest with >> great >> success. >> > > Same here. Works well. The task will not show in your rake -T > listing because of a missing desc line. Just add something like the > following: > > desc "Autotest that works with RSpec" > > to the rake file in the tasks directory for the plugin. > > Michael > railsconsulting.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On Mar 28, 2007, at 8:54 PM, Scott Taylor wrote:> > What do you think about adding this code to rspec? Or does it more > properly belong with autotest or as a plugin? > > I''ve noticed that it won''t work with a) color and b) with a checked > out rspec directory w/ rails. That means all of my describe it > spec''s won''t work, and the spec''s won''t even run. > > I''ve patched part b) for my own use. Would this be helpful to anyone?I don''t really follow you but if you want color just add: --colour to your spec.opts file. Michael railsconsulting.com
On Mar 28, 2007, at 9:26 PM, Michael Trier wrote:> > On Mar 28, 2007, at 8:54 PM, Scott Taylor wrote: > >> >> What do you think about adding this code to rspec? Or does it more >> properly belong with autotest or as a plugin? >> >> I''ve noticed that it won''t work with a) color and b) with a checked >> out rspec directory w/ rails. That means all of my describe it >> spec''s won''t work, and the spec''s won''t even run. >> >> I''ve patched part b) for my own use. Would this be helpful to >> anyone? > > I don''t really follow you but if you want color just add: > > --colour > > to your spec.opts file.Does that work for you? I''m running rspec''s trunk, so I have that checked out in vendor/rails. One of the new features in trunk, which isn''t present in the 0.8.2 gem is using describe/it instead of context/specify. I don''t think the rspec_autotest even reads the options files. Look at it''s code: class RspecAutotest < Autotest attr_accessor :spec_command def initialize # :nodoc: @spec_command = "spec --diff unified" super @exceptions = %r%^\./(?:coverage|doc)% end .... end That means that unless you override the spec_command, it''s not going to read from your spec.opts file. This is what I get when I try to run the rake task: euclid% rake spec:autotest (in /Users/smtlaissezfaire/Sites/rails/dictionary) spec --diff unified spec/models/definition_category_spec.rb spec/ helpers/terms_helper_spec.rb spec/models/definition_spec.rb spec/ models/user_term_spec.rb spec/models/user_spec.rb spec/controllers/ terms_controller_spec.rb spec/models/term_spec.rb spec/models/ category_spec.rb /Users/smtlaissezfaire/Sites/rails/dictionary/vendor/plugins/ rspec_on_rails/lib/spec/rails/version.rb:14: (RuntimeError) ######################################################################## #### Your RSpec on Rails plugin is incompatible with your installed RSpec. RSpec : 0.8.2 (r1560) RSpec on Rails : r1652 Make sure your RSpec on Rails plugin is compatible with your RSpec gem. See http://rspec.rubyforge.org/documentation/rails/install.html for details. ######################################################################## #### Notice that the command is "spec --diff ..." - without --options. That means the spec.opts isn''t being used. The version of rspec_on_rails I have checked out is the trunk version. But the command is running against rspec gem which is older than trunk. This is what I meant when I said "the specs won''t even run" Scott> > Michael > railsconsulting.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On 3/28/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:> I don''t think the rspec_autotest even reads the options files. Look > at it''s code: > > class RspecAutotest < Autotest > attr_accessor :spec_command > def initialize # :nodoc: > @spec_command = "spec --diff unified" > super > @exceptions = %r%^\./(?:coverage|doc)% > end > .... > endI replaced the default @spec_command with the following: @spec_command = "#{RAILS_ROOT}/vendor/plugins/rspec/bin/spec --diff unified --options #{RAILS_ROOT}/spec/spec.opts" This allows me to run edge-rspec as well as use the options defined in my spec.opts file. Josh -- Josh Knowles joshknowles at gmail.com http://joshknowles.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070328/854243dc/attachment.html
On Mar 28, 2007, at 10:15 PM, Josh Knowles wrote:> > > On 3/28/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > I don''t think the rspec_autotest even reads the options files. Look > at it''s code: > > class RspecAutotest < Autotest > attr_accessor :spec_command > def initialize # :nodoc: > @spec_command = "spec --diff unified" > super > @exceptions = %r%^\./(?:coverage|doc)% > end > .... > end > > > I replaced the default @spec_command with the following: > > @spec_command = "#{RAILS_ROOT}/vendor/plugins/rspec/bin/spec --diff > unified --options #{RAILS_ROOT}/spec/spec.opts" > > This allows me to run edge-rspec as well as use the options defined > in my spec.opts file. >Yeah, I did something similar. If you use --color in spec.opts, does it work? Scott
> > That means that unless you override the spec_command, it''s not going > to read from your spec.opts file. >Ah, you''re right. Sometimes I code in my sleep or at the very least quite inebriated. Sorry for the confusion. My spec line looks like this: spec --colour --diff unified I''m not running edge though. Michael railsconsulting.com
On 3/28/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:> > > > Yeah, I did something similar. > > If you use --color in spec.opts, does it work?Yes -- Josh Knowles joshknowles at gmail.com http://joshknowles.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070328/786265a8/attachment.html
On Mar 28, 2007, at 11:58 PM, Josh Knowles wrote:> > > On 3/28/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > > Yeah, I did something similar. > > If you use --color in spec.opts, does it work? > > Yes >So what did you set the spec command to in the rake task? Scott
On 3/29/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:> > So what did you set the spec command to in the rake task?@spec_command = "#{RAILS_ROOT}/vendor/plugins/rspec/bin/spec --diff unified --options #{RAILS_ROOT}/spec/spec.opts" -- Josh Knowles joshknowles at gmail.com http://joshknowles.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070329/b181fc42/attachment.html
Does it work for you if you use the DRB server specified in your opts file? What version of rspec are you using? Thanks, Scott On Mar 29, 2007, at 11:28 AM, Josh Knowles wrote:> > > On 3/29/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote: > > So what did you set the spec command to in the rake task? > > > @spec_command = "#{RAILS_ROOT}/vendor/plugins > /rspec/bin/spec --diff unified --options #{RAILS_ROOT}/spec/spec.opts" > > > > > > -- > 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