Waseem Ahmad
2011-Nov-20 17:39 UTC
How to stub "install_using_#{method}" in railties/lib/rails/commands/plugin.rb
Dear all, I am trying to write tests that test installation of plugins using "rails plugin install xxx". So far I have setup a basic PluginTest class taking inspiration from RunnerTest: railties/test/application/plugin_test.rb require ''isolation/abstract_unit'' module ApplicationTests class PluginTest < Test::Unit::TestCase def setup build_app end def teardown teardown_app end def test_successful_installing_of_plugin assert Dir.chdir(app_path) { `bundle exec rails plugin install http://example.com/my_svn_plugin` } end end end When above test is run, it will try to _actually_ install my_svn_plugin. The methods that cause installation of plugins are defined in railties/lib/rails/commands/plugin.rb. These are install_using_export, install_using_checkout, install_using_externals, install_using_http and install_using_git defined as instance methods on Plugin class. How can I stub these methods so that test does not try to _actually_ install a plugin? If there is another way I can avoid actual installation in tests, I am open to that also. Please point me to some example code that I can refer to. I am doing this to fix issue #208[1] Thanks! [1]: https://github.com/rails/rails/pull/208 -- Waseem Blog: http://babygnu.blogspot.com Twitter: http://twitter.com/_waseem -- 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.