Does anybody have any ideas for how to test a Rails Engine plugin with Rails 3? To test a Rails Engine plugin, you have to embed a full Rails application inside of the plugin''s test folder. There are a couple of old tricks for loading the plugin into the embedded Rails app, for testing: http://www.justinball.com/2009/06/16/testing-rails-engine-gems/ Those tricks don''t work any more with Rails 3, and the config.plugin_paths setting has been refactored away. I''ve been looking at some of the more prominent Rails Engine plugins, like Clearance, Devise, etc. I haven''t been able to find any examples of an embedded Rails 3 app for testing, even in the Rails 3 branch for Clearance. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
On 15 February 2010 03:50, Venue Driver <venuedriver@gmail.com> wrote:> Does anybody have any ideas for how to test a Rails Engine plugin with > Rails 3? > > To test a Rails Engine plugin, you have to embed a full Rails > application inside of the plugin''s test folder. There are a couple of > old tricks for loading the plugin into the embedded Rails app, for > testing: http://www.justinball.com/2009/06/16/testing-rails-engine-gems/ > Those tricks don''t work any more with Rails 3, and the > config.plugin_paths setting has been refactored away. > > I''ve been looking at some of the more prominent Rails Engine plugins, > like Clearance, Devise, etc. I haven''t been able to find any examples > of an embedded Rails 3 app for testing, even in the Rails 3 branch for > Clearance. >Rails 3 branch for clearance is work-in-progress as it depends upon several other gems like formtastic. Inside your test/ directory create a rails_root which is a symlink to a rails3 application. Does that not work? Anuj> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com<rubyonrails-core%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > >-- Anuj DUTTA -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Hello Anuj, thank you for your help. My problem is: how do I get the Rails app that''s in test/rails_root to load the plugin? The Rails app is inside of the plugin, rather than the plugin being inside of the Rails app like normal. test/rails_root/ vendor/plugins is empty so it doesn''t load any plugins. I have seen a couple of different references to ways to provide Rails with an alternate plugin loading path, but the one that appears to be ''most correct'' and least hackish is the config.plugin_paths setting which was refactored out of Rails, here: http://github.com/rails/rails/commit/82b9b151ffde44305d67744c0bfd9bb5505f6fbe Rails::Plugin::Locator has also been factored out of Rails, so overriding it and adding to the list of plugin_locators is no longer possible. On Feb 15, 1:31 am, Anuj Dutta <dutta.a...@googlemail.com> wrote:> Inside your test/ directory create a rails_root > which is a symlink to a rails3 application. Does that not work?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
I''m not content with the current testing strategy for Clearance. It has served us well for the 2.x series of Rails but not for Rails 3 while maintaining backwards compatibility. The most extensive backwards Rails compatibility testing of a library I''ve seen is in Hoptoad Notifier: http://github.com/thoughtbot/hoptoad_notifier/blob/master/features/step_definitions/rails_application_steps.rb That allows us to support a pretty good range of versions of Rails: http://github.com/thoughtbot/hoptoad_notifier/blob/master/SUPPORTED_RAILS_VERSIONS I''d like to see this extracted into it''s own library for testing your library for backwards Rails compatibility. It also needs to be extended to work with Rails 3. On Mon, Feb 15, 2010 at 1:31 AM, Anuj Dutta <dutta.anuj@googlemail.com> wrote:> > > On 15 February 2010 03:50, Venue Driver <venuedriver@gmail.com> wrote: >> >> Does anybody have any ideas for how to test a Rails Engine plugin with >> Rails 3? >> >> To test a Rails Engine plugin, you have to embed a full Rails >> application inside of the plugin''s test folder. There are a couple of >> old tricks for loading the plugin into the embedded Rails app, for >> testing: http://www.justinball.com/2009/06/16/testing-rails-engine-gems/ >> Those tricks don''t work any more with Rails 3, and the >> config.plugin_paths setting has been refactored away. >> >> I''ve been looking at some of the more prominent Rails Engine plugins, >> like Clearance, Devise, etc. I haven''t been able to find any examples >> of an embedded Rails 3 app for testing, even in the Rails 3 branch for >> Clearance. > > > Rails 3 branch for clearance is work-in-progress as it depends upon several > other gems like formtastic. Inside your test/ directory create a rails_root > which is a symlink to a rails3 application. Does that not work? > > Anuj > > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To post to this group, send email to rubyonrails-core@googlegroups.com. >> To unsubscribe from this group, send email to >> rubyonrails-core+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-core?hl=en. >> > > > > -- > Anuj DUTTA > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. >-- Dan Croak @Croaky -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Not sure if this helps you, but I''m treating all my engine plugins as standalone rails applications. What this means is each engine plugin is theoretically able to run as a standalone application and can therefor be tested the same way as any other rails application. I think the overhead is acceptable and it has worked well for the past couple years. Daniel On Feb 15, 10:48 am, Venue Driver <venuedri...@gmail.com> wrote:> Hello Anuj, thank you for your help. > > My problem is: how do I get the Rails app that''s in test/rails_root to > load the plugin? The Rails app is inside of the plugin, rather than > the plugin being inside of the Rails app like normal. test/rails_root/ > vendor/plugins is empty so it doesn''t load any plugins. > > I have seen a couple of different references to ways to provide Rails > with an alternate plugin loading path, but the one that appears to be > ''most correct'' and least hackish is the config.plugin_paths setting > which was refactored out of Rails, here:http://github.com/rails/rails/commit/82b9b151ffde44305d67744c0bfd9bb5... > > Rails::Plugin::Locator has also been factored out of Rails, so > overriding it and adding to the list of plugin_locators is no longer > possible. > > On Feb 15, 1:31 am, Anuj Dutta <dutta.a...@googlemail.com> wrote: > > > > > Inside your test/ directory create a rails_root > > which is a symlink to a rails3 application. Does that not work?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
On Feb 15, 10:48 am, Venue Driver <venuedri...@gmail.com> wrote:> Hello Anuj, thank you for your help. > > My problem is: how do I get the Rails app that''s in test/rails_root to > load the plugin? The Rails app is inside of the plugin, rather than > the plugin being inside of the Rails app like normal. test/rails_root/ > vendor/plugins is empty so it doesn''t load any plugins.Jose Valim seems to be creating a gem to test rails plugins: see http://github.com/josevalim/enginex -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.