3 This section describes how to add a helper named 'WoodpeckersHelper' to your plugin that will behave the same as a helper in your main app. This is very similar to adding a model and a controller.
5 You can test your plugin's helper as you would test any other helper:
7 *vendor/plugins/yaffle/test/woodpeckers_helper_test.rb*
10 ---------------------------------------------------------------
11 require File.dirname(__FILE__) + '/test_helper.rb'
12 include WoodpeckersHelper
14 class WoodpeckersHelperTest < Test::Unit::TestCase
16 assert_equal "Tweet! Hello", tweet("Hello")
19 ---------------------------------------------------------------
21 This is just a simple test to make sure the helper is being loaded correctly. After watching it fail with `rake`, you can make it pass like so:
23 *vendor/plugins/yaffle/lib/yaffle.rb:*
26 ----------------------------------------------
27 %w{ models controllers helpers }.each do |dir|
28 path = File.join(File.dirname(__FILE__), 'app', dir)
30 ActiveSupport::Dependencies.load_paths << path
31 ActiveSupport::Dependencies.load_once_paths.delete(path)
34 ActionView::Base.send :include, WoodpeckersHelper
35 ----------------------------------------------
38 *vendor/plugins/yaffle/lib/app/helpers/woodpeckers_helper.rb:*
41 ----------------------------------------------
42 module WoodpeckersHelper
49 ----------------------------------------------
51 Now your test should be passing, and you should be able to use the Woodpeckers helper in your app.