Hi We are looking at moving a project over from 1.05 to 1.08 but have a problem with some of our helper specs They work fine in 1.05 but error in 1.08 and it is the calls to route helper methods that seems to be the problem. I did some playing around .. because the code being tested is reasonably large etc ... but this sample (using the peepcode app) seems to boil down the problem describe WeathersHelper do it do weather = Weather.new weather.id = 1 weather_path(weather).should == "/weathers/1" end end This passes in 1.05 and throws an exception in 1.08 ... is seems that the route helper method is not available. BTW, in our actual code the call to weather_path is in the helper ... I just put it in the above for simplicity. So I am wondering what may have changed and what do I need to configure?? Thanks Shane Shane Mingins ELC Technologies (TM) PO Box 247 Santa Barbara, CA 93102 Phone: +64 4 568 6684 Mobile: +64 21 435 586 Email: smingins at elctech.com AIM: ShaneMingins Skype: shane.mingins (866) 863-7365 Tel - Santa Barbara Office (866) 893-1902 Fax - Santa Barbara Office +44 020 7504 1346 Tel - London Office +44 020 7504 1347 Fax - London Office http://www.elctech.com -------------------------------------------------------------------- Privacy and Confidentiality Notice: The information contained in this electronic mail message is intended for the named recipient(s) only. It may contain privileged and confidential information. If you are not an intended recipient, you must not copy, forward, distribute or take any action in reliance on it. If you have received this electronic mail message in error, please notify the sender immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070904/54e180b4/attachment.html
On 9/3/07, Shane Mingins <smingins at elctech.com> wrote:> Hi > > We are looking at moving a project over from 1.05 to 1.08 but have a problem > with some of our helper specs > > They work fine in 1.05 but error in 1.08 and it is the calls to route helper > methods that seems to be the problem. > > I did some playing around .. because the code being tested is reasonably > large etc ... but this sample (using the peepcode app) seems to boil down > the problem > > describe WeathersHelper do > it do > weather = Weather.new > weather.id = 1 > weather_path(weather).should == "/weathers/1" > end > end > > This passes in 1.05 and throws an exception in 1.08 ... is seems that the > route helper method is not available. > > BTW, in our actual code the call to weather_path is in the helper ... I just > put it in the above for simplicity. > > So I am wondering what may have changed and what do I need to configure??I am going to guess that it''s something like this: 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.<< If not, please post the error (good idea to do that in general). If so, this is fixed in trunk. Attached is a patch you can use to address it in your rails app (apply from vendor/plugins) Please let us know if this fixes the problem. Cheers, David> > Thanks > Shane > > > > Shane Mingins > ELC Technologies (TM) > PO Box 247 > Santa Barbara, CA 93102 > > Phone: +64 4 568 6684 > Mobile: +64 21 435 586 > Email: smingins at elctech.com > AIM: ShaneMingins > Skype: shane.mingins > > (866) 863-7365 Tel - Santa Barbara Office > (866) 893-1902 Fax - Santa Barbara Office > > +44 020 7504 1346 Tel - London Office > +44 020 7504 1347 Fax - London Office > > http://www.elctech.com > > -------------------------------------------------------------------- > Privacy and Confidentiality Notice: > The information contained in this electronic mail message is intended for > the named recipient(s) only. It may contain privileged and confidential > information. If you are not an intended recipient, you > must not copy, forward, distribute or take any action in reliance on it. If > you have received this electronic mail message in error, please notify the > sender immediately. > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- A non-text attachment was scrubbed... Name: helper_bug_fix.patch Type: application/octet-stream Size: 618 bytes Desc: not available Url : http://rubyforge.org/pipermail/rspec-users/attachments/20070903/76e8278e/attachment.obj
On 4/09/2007, at 3:44 PM, David Chelimsky wrote:> On 9/3/07, Shane Mingins <smingins at elctech.com> wrote: >> Hi >> >> We are looking at moving a project over from 1.05 to 1.08 but have >> a problem >> with some of our helper specs >> >> They work fine in 1.05 but error in 1.08 and it is the calls to >> route helper >> methods that seems to be the problem. >> >> I did some playing around .. because the code being tested is >> reasonably >> large etc ... but this sample (using the peepcode app) seems to >> boil down >> the problem >> >> describe WeathersHelper do >> it do >> weather = Weather.new >> weather.id = 1 >> weather_path(weather).should == "/weathers/1" >> end >> end >> >> This passes in 1.05 and throws an exception in 1.08 ... is seems >> that the >> route helper method is not available. >> >> BTW, in our actual code the call to weather_path is in the >> helper ... I just >> put it in the above for simplicity. >> >> So I am wondering what may have changed and what do I need to >> configure?? > > I am going to guess that it''s something like this: > > 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.<< > > If not, please post the error (good idea to do that in general). > > If so, this is fixed in trunk. Attached is a patch you can use to > address it in your rails app (apply from vendor/plugins) > > Please let us know if this fixes the problem. > > Cheers, > David >Hi David Thank you .. yes that fixed that problem, although it looks like I have other''s to look at regarding routes. Sorry I did not post error message ... I did not think it was such a useful message ;-) Cheers Shane
On 4/09/2007, at 3:44 PM, David Chelimsky wrote:> > I am going to guess that it''s something like this: > > 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.<< > > If not, please post the error (good idea to do that in general). > > If so, this is fixed in trunk. Attached is a patch you can use to > address it in your rails app (apply from vendor/plugins) > > Please let us know if this fixes the problem. > > Cheers, > David >Boiled down the next routes problem in a helper spec ... using with_routing it do with_routing do |set| set.draw do |map| map.resources :articles do |article| article.resources :comments, :name_prefix => ''a_'' do | comment| comment.resources :ratings, :name_prefix => ''a_c_'' end end end a_c_rating_path(@article, @comment, @rating).should == "/ articles/1/comments/1/ratings/1" end end This works fine in 1.05 and errors in 1.08 with the error: NoMethodError in ''CommentsHelper NO NAME (Because of Error raised in matcher)'' 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.<< Cheers Shane
On 9/4/07, Shane Mingins <smingins at elctech.com> wrote:> > On 4/09/2007, at 3:44 PM, David Chelimsky wrote: > > > > > I am going to guess that it''s something like this: > > > > 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.<< > > > > If not, please post the error (good idea to do that in general). > > > > If so, this is fixed in trunk. Attached is a patch you can use to > > address it in your rails app (apply from vendor/plugins) > > > > Please let us know if this fixes the problem. > > > > Cheers, > > David > > > > > Boiled down the next routes problem in a helper spec ... using > with_routing > > it do > with_routing do |set| > > set.draw do |map| > map.resources :articles do |article| > article.resources :comments, :name_prefix => ''a_'' do | > comment| > comment.resources :ratings, :name_prefix => ''a_c_'' > end > end > end > > a_c_rating_path(@article, @comment, @rating).should == "/ > articles/1/comments/1/ratings/1" > > end > end > > This works fine in 1.05 and errors in 1.08 with the error: > > NoMethodError in ''CommentsHelper NO NAME (Because of Error raised in > matcher)''The NO NAME part is because you wrote ''it do'' with no message passed to it.> 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.<<This looks like the same error - can you run just the file w/ this spec like this: spec path/to/file.rb -b That''ll produce the full backtrace. Thanks> > Cheers > Shane > > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On 5/09/2007, at 10:00 AM, David Chelimsky wrote:> This looks like the same error - can you run just the file w/ this > spec like this: > > spec path/to/file.rb -b > > That''ll produce the full backtrace. > > ThanksYeah it does look similar (I was reading the bug report last night) 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.<< /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/ helpers/prototype_helper.rb:538:in `<<'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/ helpers/prototype_helper.rb:695:in `initialize'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/ helpers/prototype_helper.rb:616:in `new'' /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/ helpers/prototype_helper.rb:616:in `method_missing'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/matchers.rb: 159:in `method_missing'' ./spec/helper/comments_helper_spec.rb:50: /opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/test_process.rb:488:in `with_routing'' ./spec/helper/comments_helper_spec.rb:37: /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/example.rb: 81:in `instance_eval'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/example.rb: 81:in `run_example'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/example.rb: 26:in `run'' /opt/local/lib/ruby/1.8/timeout.rb:48:in `timeout'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/example.rb: 24:in `run'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/ behaviour.rb:81:in `run'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/ behaviour.rb:75:in `each'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/dsl/ behaviour.rb:75:in `run'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/ behaviour_runner.rb:58:in `run_behaviours'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/ behaviour_runner.rb:57:in `each'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/ behaviour_runner.rb:57:in `run_behaviours'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/ behaviour_runner.rb:21:in `run'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/ command_line.rb:17:in `run'' /opt/local/lib/ruby/gems/1.8/gems/rspec-1.0.8/bin/spec:3: /opt/local/bin/spec:16:in `load'' /opt/local/bin/spec:16:
On 5/09/2007, at 10:00 AM, David Chelimsky wrote:>> Boiled down the next routes problem in a helper spec ... using >> with_routing >> >> it do >> with_routing do |set| >> >> set.draw do |map| >> map.resources :articles do |article| >> article.resources :comments, :name_prefix => ''a_'' do | >> comment| >> comment.resources :ratings, :name_prefix => ''a_c_'' >> end >> end >> end >> >> a_c_rating_path(@article, @comment, @rating).should == "/ >> articles/1/comments/1/ratings/1" >> >> end >> end >> >> This works fine in 1.05 and errors in 1.08 with the 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.<< > > This looks like the same error - can you run just the file w/ this > spec like this: > > spec path/to/file.rb -b > > That''ll produce the full backtrace. > > Thanks > >>Hi David I kept poking around but I cannot see why this is now not working .... not quite sure where the changes occurred in rspec that affected this but after using the with_routing method the example does not have access to the new routes (and still has the old ones). With the fix giving the helper spec access to the named_routes .... did anyone actually decide how this was broken in the first place? I was wondering how the helper specs had access to the named_routes previously? Should I add the bug on the projects tracker for this? Cheers Shane
On 9/5/07, Shane Mingins <smingins at elctech.com> wrote:> > On 5/09/2007, at 10:00 AM, David Chelimsky wrote: > > >> Boiled down the next routes problem in a helper spec ... using > >> with_routing > >> > >> it do > >> with_routing do |set| > >> > >> set.draw do |map| > >> map.resources :articles do |article| > >> article.resources :comments, :name_prefix => ''a_'' do | > >> comment| > >> comment.resources :ratings, :name_prefix => ''a_c_'' > >> end > >> end > >> end > >> > >> a_c_rating_path(@article, @comment, @rating).should == "/ > >> articles/1/comments/1/ratings/1" > >> > >> end > >> end > >> > >> This works fine in 1.05 and errors in 1.08 with the 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.<< > > > > This looks like the same error - can you run just the file w/ this > > spec like this: > > > > spec path/to/file.rb -b > > > > That''ll produce the full backtrace. > > > > Thanks > > > >> > > > Hi David > > I kept poking around but I cannot see why this is now not > working .... not quite sure where the changes occurred in rspec that > affected this but after using the with_routing method the example > does not have access to the new routes (and still has the old ones). > > With the fix giving the helper spec access to the named_routes .... > did anyone actually decide how this was broken in the first place? I > was wondering how the helper specs had access to the named_routes > previously? > > Should I add the bug on the projects tracker for this?Please.> > Cheers > Shane > > > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >