RSpec seems to be having a hard time loading Helper classes

I am getting the error when I run the command: rake spec

This is a new project with not current test written besides the ones
auto-created for me.

+++++++++
$ rake spec
(in /Users/chrisolsen/Projects/Rails/chrisolsen/trunk)
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:266:in
load_missing_constant': uninitialized constant ProjectsHelper (NameError) from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:inconst_missing’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
const_missing' from ./spec/helpers/projects_helper_spec.rb:3 from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:inload’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in
load' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:innew_constants_in’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in
load' from /Users/chrisolsen/Projects/Rails/chrisolsen/trunk/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:106:inload_specs’
… 14 levels…
from
/Users/chrisolsen/Projects/Rails/chrisolsen/trunk/vendor/plugins/rspec/lib/spec/runner/option_parser.rb:155:in
parse' from /Users/chrisolsen/Projects/Rails/chrisolsen/trunk/vendor/plugins/rspec/lib/spec/runner/option_parser.rb:88:increate_behaviour_runner’
from
/Users/chrisolsen/Projects/Rails/chrisolsen/trunk/vendor/plugins/rspec/lib/spec/runner/command_line.rb:14:in
`run’
from
/Users/chrisolsen/Projects/Rails/chrisolsen/trunk/vendor/plugins/rspec/bin/spec:3
rake aborted!
Command ruby
-I"/Users/chrisolsen/Projects/Rails/chrisolsen/trunk/vendor/plugins/rspec/lib"
“/Users/chrisolsen/Projects/Rails/chrisolsen/trunk/vendor/plugins/rspec/bin/spec”
“spec/controllers/projects_controller_spec.rb”
“spec/helpers/projects_helper_spec.rb” “spec/models/project_spec.rb”
“spec/views/projects/edit.rhtml_spec.rb”
“spec/views/projects/index.rhtml_spec.rb”
“spec/views/projects/new.rhtml_spec.rb”
“spec/views/projects/show.rhtml_spec.rb” --options
“/Users/chrisolsen/Projects/Rails/chrisolsen/trunk/config/…/spec/spec.opts”
failed
++++++++++

The projects_helper_spec.rb file does exist in the helper dir only
containing the following:

+++++++++
require File.dirname(FILE) + ‘/…/spec_helper’

describe ProjectsHelper do # Helper methods can be called directly in
the examples (it blocks)
end
+++++++++

Thanks in advance for any help.

On 10 Oct 2007, at 22:45, Chris O. wrote:

I am getting the error when I run the command: rake spec

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:266:in
`load_missing_constant’: uninitialized constant ProjectsHelper
“spec/helpers/projects_helper_spec.rb” “spec/models/project_spec.rb”

+++++++++
require File.dirname(FILE) + ‘/…/spec_helper’

describe ProjectsHelper do # Helper methods can be called directly in
the examples (it blocks)
end
+++++++++

So, it the problem is that the ProjectsHelper constant doesn’t exist,
which probably means that app/helpers/projects_helper doesn’t exist,
or doesn’t declare the ProjectsHelper module.

It could, of course, also be a pluralisation problem, with
ProjectsHelper being called in place of ProjectHelper.

Anyway, whatever it is, you need to make sure that the class/module
name following ‘describe’ in your helper spec is actually defined
somewhere.

Matt


Matt P. | Design & Code
| http://www.reprocessed.org/

That was the problem. I didn’t even occur to me that it was looking for
that helper class.

Thanks for the help.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs