You need to run http://haml-lang.com/docs/yardoc/Haml/Helpers.html#init_haml_helpers-instance_method
On Wed, Nov 24, 2010 at 6:26 AM, SeanWalberg <[email protected]> wrote: > I've got a helper inside application_helper.rb: > > def track_event(event, opts = {}) > return "" if Rails.env.development? > javascript_tag do > "mpmetrics.track(\"#{event}\");" > end > end > > I want to write a test so I can improve this helper: > > require File.dirname(__FILE__) + "/../test_helper.rb" > require "application_helper" > require 'haml/helpers/action_view_mods' > > class ApplicationHelperTest < Test::Unit::TestCase > > include ActionView::Helpers > include ApplicationHelper > include Haml > include Haml::Helpers > > context "mixpanel api" do > > should "track a simple event" do > assert_equal "blah", track_event("blah") > end > > end > > end > > However when I run it, I get: > > 1) Error: > test: mixpanel api should track a simple event. > (ApplicationHelperTest): > NoMethodError: undefined method `output_buffer=' for > #<ApplicationHelperTest:0xb729fd8> > haml (3.0.24) lib/haml/helpers/action_view_mods.rb:92:in `capture' > app/helpers/application_helper.rb:12:in `track_event' > helpers/application_helper_test.rb:17:in > `__bind_1290608547_577398' > > > I can't figure out what I have to include to get this to run. I know > it's related to the javascript_tag, as a test on a helper that doesn't > use javascript_tag works just fine. > > Any advice would be appreciated. Thanks. > > Sean > > -- > You received this message because you are subscribed to the Google Groups > "Haml" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected] <haml%[email protected]>. > For more options, visit this group at > http://groups.google.com/group/haml?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
