views:

160

answers:

0

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?