From f5b991d76dc5d21f1870da067fb3101440256fba Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 27 Mar 2008 17:47:51 +0000 Subject: Added Plugin#about method to programmatically access the about.yml in a plugin (closes #10979) [lazyatom] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9098 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/test/plugin_test.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'railties/test/plugin_test.rb') diff --git a/railties/test/plugin_test.rb b/railties/test/plugin_test.rb index 32c72f1b31..1445338f14 100644 --- a/railties/test/plugin_test.rb +++ b/railties/test/plugin_test.rb @@ -130,9 +130,27 @@ uses_mocha "Plugin Tests" do end assert plugin.loaded? end + + def test_should_make_about_yml_available_as_about_method_on_plugin + plugin = plugin_for(@valid_plugin_path) + assert_equal "Plugin Author", plugin.about['author'] + assert_equal "1.0.0", plugin.about['version'] + end + + def test_should_return_empty_hash_for_about_if_about_yml_is_missing + assert_equal({}, plugin_for(about_yml_plugin_path('plugin_without_about_yaml')).about) + end + + def test_should_return_empty_hash_for_about_if_about_yml_is_malformed + assert_equal({}, plugin_for(about_yml_plugin_path('bad_about_yml')).about) + end private + def about_yml_plugin_path(name) + File.join(File.dirname(__FILE__), 'fixtures', 'about_yml_plugins', name) + end + def plugin_for(path) Rails::Plugin.new(path) end -- cgit v1.2.3