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`](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 #2081
Thanks!