I'm trying to include some helpers to test with rspec but no luck.
What I did:
created a support/helpers.rb
file under my spec
folder.
support/helpers.rb
module Helpers
include ActionView::Helpers::NumberHelper
include ActionView::Helpers::TextHelper
end
and tried to require this file in spec_helper.rb
.
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'rubygems'
require 'spork'
require 'support/helpers'
Spork.prefork do
.
.
end
this generates the following error:
/spec/support/helpers.rb:2:in `<module:Helpers>': uninitialized constant Helpers::ActionView (NameError)
How should I do this helpers to be available with Rspec?
Thanks.
File.dirname(__FILE__)
instead ofRails.root
since they will differ. – Metheglin