Problems running steak with Spork -- helpers not loaded correctly

124 views
Skip to first unread message

Jack Kinsella

unread,
Apr 15, 2011, 5:29:37 AM4/15/11
to Steak
Hey,

Steak is working great for me without Spork but whenever I run it
using Spork I get "undefined local variable" errors whenever my code
hits a helper method. Has anyone had any similar issues? My spork (if
that's relevant).

require 'rubygems'
require 'spork'
ENV["RAILS_ENV"] ||= 'test'

Spork.prefork do
# Loading more in this block will cause your tests to run faster.
However,
# if you change any configuration or code from libraries loaded
here, you'll
# need to restart spork for it take effect.
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'

# Requires supporting ruby files with custom matchers and macros,
etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
end

Spork.each_run do
# This code will be run each time you run your specs.
Dir[Rails.root.join("site/app/**/*.rb")].each {|f| require f}
load "#{Rails.root}/spec/global_test_helper.rb"

require "#{Rails.root}/spec/factories.rb"
end

Many Thanks,

Jack Kinsella

Tiago Albineli Motta

unread,
Apr 17, 2011, 8:50:12 AM4/17/11
to Steak
can you put all line of your error message?

Jack Kinsella

unread,
Apr 18, 2011, 4:24:18 AM4/18/11
to Steak
Sure thing Tiago. When I run the acceptance tests I get this
backtrace:

Failure/Error: login_as_admin
ActionView::Template::Error:
undefined local variable or method `typekit_fonts' for
#<#<Class:0x4fd8f78>:0x4fd718c>
# ./site/app/views/layouts/spree_application.html.erb:6:in `block
in
_site_app_views_layouts_spree_application_html_erb__511333542_41843800_465909208'
# ./site/app/views/layouts/spree_application.html.erb:3:in
`_site_app_views_layouts_spree_application_html_erb__511333542_41843800_465909208'
# <internal:prelude>:10:in `synchronize'
# ./spec/acceptance/support/helpers.rb:18:in `login'
# ./spec/acceptance/support/helpers.rb:12:in `login_as_admin'
# ./spec/acceptance/buyer_inquiries_count_spec.rb:16:in `block (2
levels) in <top (required)>'

The supposedly undefined local variable or method is defined in my
ApplicationHelper and works fine in non sporked steaks. I can't figure
out the methods don't get included in the sporked process.

Kai Schlamp

unread,
Apr 27, 2011, 11:14:20 PM4/27/11
to Steak
Same problem here. Paths and helper methods under acceptance/support
are not accessible (undefined local variable or method). I am also
using Spork (latest from Github) and Ruby 1.9.2 under Rails 3.0.7.
Reply all
Reply to author
Forward
0 new messages