Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #109. Helpers now available to request specs. #140

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions lib/spork/app_framework/rails.rb
Original file line number Diff line number Diff line change
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