This should work:

before :each do
  @haml_is_haml = true
  @haml_stack = [Haml::Buffer.new(:attr_wrapper => "'")]
end

However, because this is so useful, I've added it as a helper in trunk. 
It would be easier to grab that and just run

before(:each) { init_haml_helpers }

Note that capture still won't work, due to some strange interactions (or 
the lack thereof) between Haml and ActionView. Use capture_haml instead; 
it does the same thing, but will work.

Let me know if this doesn't work.

- Nathan

wolfmanjm wrote:
> Ok I'm making progress :) Now I can actually post an error from within
> HAML!
>
> So I added this to my spec, which cleared up most of the previous
> errors...
>
>   describe ApplicationHelper do
>     include ActionView::Helpers
>     include ActionView::Helpers::CaptureHelper
>     include Haml::Helpers
>    ...
>
> It now finds HAML and calls HAML#open it also can find capture.
>
> Now I get this error, presumably because the HAML buffer has not been
> initialized. So is there a call I shol dmake to initialize HAML in the
> spec test?
>
>   You have a nil object when you didn't expect it!
>   You might have expected an instance of Array.
>   The error occurred while evaluating nil.[]
>   /home/morris/work/snowdogsrus/rails/snowdogsrus/config/../vendor/
> plugins/haml/lib/haml/helpers.rb:276:in `buffer'
>   /home/morris/work/snowdogsrus/rails/snowdogsrus/config/../vendor/
> plugins/haml/lib/haml/helpers.rb:259:in `open'
>   /home/morris/work/snowdogsrus/rails/snowdogsrus/config/../app/
> helpers/application_helper.rb:15:in `display_flash'

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to