Search code examples
ruby-on-railscucumberspork

Rails 3.2.3 with spork does not recognize helper methods in cucumber tests


I have a application that is using rails 3.2.3 and spork 1.0.0rc2. When I run my cucumber test I get:

ActionView::Template::Error: undefined local variable or method `page_title'

Where page_title is defined in my application helper. I am not sure what broke them as it was working until the last bundle update.

Anyone having the same issue?


Solution

  • To fix this issue add these below lines in Spork.prefork block

    full_names = Dir["#{Rails.root}/app/helpers/*.rb"]
    
    full_names.collect do |full_name|
        include Object.const_get(File.basename(full_name,'.rb').camelize)
    end