Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 675
Calin Avatar asked Apr 18 '12 20:04

Calin


2 Answers

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
like image 191
SSP Avatar answered Nov 15 '22 19:11

SSP


Take a look at this thread https://github.com/sporkrb/spork-rails/issues/6#issuecomment-11105681 there are two solutions for this problem

like image 29
Andrey Kryachkov Avatar answered Nov 15 '22 19:11

Andrey Kryachkov