Problem with helpers in view

Yametazamwa mara 23
Ruka hadi kwenye ujumbe wa kwanza ambao haujasomwa

Martin

hayajasomwa,
28 Nov 2009, 12:05:3728/11/2009
kwa sporkgem
Hi,

I posted my problem first on rspec-users but I got the tip that this
would be the right place to ask. So here I am ;-)

I've got a problem when using spork. If I use a helper method which is
defined in a custom helper module (app/helpers/simple_helper.rb) then
I got the following error when running "rake spec".

ActionView::TemplateError in '/items/index.html.erb renders a list of
items'
undefined method `simpleFunction' for #<ActionView::Base:0x2409c44>
On line #2 of app/views/items/index.html.erb

This simpleFunction is defined in app/helpers/simple_helper.rb. The
error does not occur when running "rake spec" without spork.

I put this simple rails project as example on github: http://github.com/JerryWho/test

First I thought simple_helper.rb isn't loaded but that's not correct.
Using some puts $" I can see that the file is loaded.

Any ideas what I'm doing wrong?

Thanks,
Martin

Martin

hayajasomwa,
28 Nov 2009, 12:06:5428/11/2009
kwa sporkgem
As always I once again forgot to tell you the versions I'm using:
spork 0.7.3
rspec 1.2.9
rails 2.3.5

Tim Harper

hayajasomwa,
3 Des 2009, 15:38:2403/12/2009
kwa spor...@googlegroups.com
> --
>
> As always I once again forgot to tell you the versions I'm using:
> spork 0.7.3
> rspec 1.2.9
> rails 2.3.5
>

This sounds nasty :( I've starred this email but I've procrastinated
getting to it because I'm afraid it may take an hour or so to delve in
and find the issue. Rails internals can be not very fun to spelunk
sometimes.

Tim

Tim Harper

hayajasomwa,
4 Des 2009, 10:17:0104/12/2009
kwa spor...@googlegroups.com
> This sounds nasty :(  I've starred this email but I've procrastinated
> getting to it because I'm afraid it may take an hour or so to delve in
> and find the issue. Rails internals can be not very fun to spelunk
> sometimes.
>
> Tim
>

Reproduced the problem in your test application. In an even more
strange turn of events, running "spec spec/views" fails, but "cd spec
&& spec views" passes.

What an exciting mystery to be solved! ;)

Tim Harper

hayajasomwa,
4 Des 2009, 10:20:4804/12/2009
kwa spor...@googlegroups.com
Doh, that was because it wasn't picking up the spec options, and
therefore wasn't using spork :S lol

Tim Harper

hayajasomwa,
4 Des 2009, 23:35:2304/12/2009
kwa spor...@googlegroups.com
Hey Martin,

I deployed a fix to gemcutter (0.7.4). It works with your example, so
it should fix your real case as well.

It was kind of a big pain to track down :S Spork is really fighting
some of the rails magic to make things work. Most of the cases work,
but these little edge cases pop up and they are a bugger.

Anyways, I added another test to lock it down, and tested it against
rails 2.1.0, 2.2.x, and 2.3.5.

Tim

Martin

hayajasomwa,
5 Des 2009, 06:06:4905/12/2009
kwa spor...@googlegroups.com
Hi Tim,

>
> I deployed a fix to gemcutter (0.7.4). It works with your example, so
> it should fix your real case as well.
>

yes it does. Thank you very much.

> It was kind of a big pain to track down :S Spork is really fighting
> some of the rails magic to make things work. Most of the cases work,
> but these little edge cases pop up and they are a bugger.

I took a look at what you have changed. I have to say that's really
beyond my horizon.

So thanks again for your great work.

Martin
Jibu wote
Mjibu mchapishaji
Sambaza
Ujumbe 0 mpya