cavalle / steak

DISCONTINUED - The delicious combination of RSpec and Capybara for Acceptance BDD
MIT License
763 stars 32 forks source link

Helpers not loaded when used in conjunction with Spork #36

Closed jackkinsella closed 13 years ago

jackkinsella commented 13 years ago

When I run a spork rspec I get undefined local var errors when I reference helper methods in my layout files. Same issue does not happen when steak is run without sproking a process. My spork file:


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

Any ideas?

cavalle commented 13 years ago

Please ask in the mailing list. Github issues are only for bugs and feature requests

ilyakatz commented 12 years ago

its been bugging me as well, so far i haven't found any good solution but i didn't want not to run spork because of this, so while i don't have a permanent solution, i did this

Spork.each_run do
  class ActionView::Base
    include Gritter::Helpers
  end
end