[rspec-devel] [ rspec-Bugs-13493 ] routing shortcuts no longer work in helper specs (in rspec v1.0.8)

noreply at rubyforge.org noreply at rubyforge.org
Wed Aug 29 15:03:05 EDT 2007


Bugs item #13493, was opened at 2007-08-29 13:45
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13493&group_id=797

Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Jeremy Stephens (viking415)
Assigned to: Nobody (None)
Summary: routing shortcuts no longer work in helper specs (in rspec v1.0.8)

Initial Comment:
In my helper I have code that calls some *_path methods that are created using resources in my routes config file.  I upgraded rspec from 1.0.5 to 1.0.8., and when I run my helper specs, I get this error:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<<                                                             
./config/../app/helpers/memberships_helper.rb:8:in `link_to_index'
./spec/helpers/memberships_helper_spec.rb:18:
script/spec:15:

Upon further investigation I found that my call to 'memberships_path' in the helper I'm testing first goes to Spec::Matchers#method_missing, and then to ActionView::Helpers::PrototypeHelper::JavascriptGenerator::GeneratorMethods#method_missing, where it throws the error.

----------------------------------------------------------------------

>Comment By: Jeremy Stephens (viking415)
Date: 2007-08-29 14:03

Message:
Just to make sure I generated two fresh rails installs, one
with rspec 1.0.5 and the other with 1.0.8, and I generated
rspec_scaffold for each.  I created a simple method in the
helper that did this:

def foo
  bars_path
end

I wrote a test for it, and it passed in the 1.0.5 version,
but failed in the 1.0.8 version with the error I mentioned
in the original post.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=13493&group_id=797


More information about the rspec-devel mailing list