Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for issue #109. Helpers now available to request specs.
  • Loading branch information
Jack Kinsella committed Sep 12, 2011
1 parent 2bb3143 commit f8351ae
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions lib/spork/app_framework/rails.rb
Expand Up @@ -55,28 +55,6 @@ def eager_load!
# Spork.trap_method(::AbstractController::Helpers::ClassMethods, :helper)
Spork.trap_method(::ActiveModel::Observing::ClassMethods, :instantiate_observers)
Spork.each_run { ActiveRecord::Base.establish_connection rescue nil } if Object.const_defined?(:ActiveRecord)


AbstractController::Helpers::ClassMethods.module_eval do
def helper(*args, &block)
([args].flatten - [:all]).each do |arg|
next unless arg.is_a?(String)
filename = arg + "_helper"
unless ::ActiveSupport::Dependencies.search_for_file(filename)
# this error message must raise in the format such that LoadError#path returns the filename
raise LoadError.new("Missing helper file helpers/%s.rb" % filename)
end
end

Spork.each_run(false) do
modules_for_helpers(args).each do |mod|
add_template_helper(mod)
end

_helpers.module_eval(&block) if block_given?
end
end
end
end

end

0 comments on commit f8351ae

Please sign in to comment.