In my experience with cucumber+haml, this sort of thing is most commonly caused by ambiguity in method calling and haml losing track of the scope in conditionals. Try wrapping parentheses around all your methods.
Up vote 3 down vote favorite share g+ share fb share tw.
Been having a problem with Rails/Cucumber/Haml. The below Haml file works perfectly in the development and live environments but fails in Cucumber with the following error: /app/views/competitions/show. Haml:30: syntax error, unexpected kENSURE, expecting $end (ActionView::TemplateError) On line #30 of app/views/competitions/show.
Haml Line #30 is the end of the file. It works in Haml gem version 2.2.3 but not in later ones (I've tried 2.2.23, 2.2.22, 2.2.17) - title @competition. Name %h1 =h @competition.
Name - if @competition. Image? #main_image = image_tag(@competition.
Image_url) = RedCloth. New(@competition. Description).
To_html %h2 =h @competition. Question %p - if @competition. Running?
= link_to 'Enter competition', enter_path(:id => @competition. Secret) - else = case @competition. State - when 'scheduled' then 'Competition has not opened' - when 'closed' then 'Competition closed' if can?
:update, @competition = link_to 'Edit', edit_competition_path(@competition) | - if can? :show_stats, @competition = link_to 'View stats', competition_stats_path(@competition) Any ideas what's happening? Ruby-on-rails cucumber haml link|improve this question asked Apr 21 '10 at 22:03alexiso161.
2 Hard to tell what's happening without having the actual code in front of me. Try temporarily deleting blocks of code, one at a time, and see what effect that has. Start to narrow it down.
For example try deleting everything under and including the %p block, then re-run the tests. – Robert Speicher Apr 21 '10 at 23:19 On line number 24, did you mean to escape if can? :update, @competition to be interpreted as ruby code by preceding it with a hyphen?
- if can? :update, @competition. – Stephen Waits Mar 23 '11 at 1:12 any chance you have an ensure..end exception handling block just prior to this HAML file being called?
Seems to me an ensure has been called without an appropriate end, and the HAML file just happens to be in the wrong place at the wrong time. The error might be unrelated to this file. – Aboutimage May 27 '11 at 2:42 Beyond the issue noted by Stephen, that error is usually caused by an open-ended conditional.
That is, a conditional like an if ("- if 1 == 1") that does not have anything indented underneath it to execute if it evaluates to true. If there's nothing underneath the conditional for HAML to work with, then it doesn't generate the "end" for the conditional. Check each of your conditional blocks to ensure that something is actually happening if/when they are true.
– Yardboy Jun 6 '11 at 19:30.
In my experience with cucumber+haml, this sort of thing is most commonly caused by ambiguity in method calling and haml losing track of the scope in conditionals. Try wrapping parentheses around all your methods. In the code you posted, the first if is also missing its -.
I'd also recommend trying putting the when case section into a helper as haml sometimes gets confused with things like that, especially as they are set with -. Which version of Rails are you running?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.