Have a look at this: http://pastie.textmate.org/85317
That should work out. Don On Aug 6, 2007, at 2:04 PM, Gaston Ramos wrote: > El lun, 06 de ago de 2007, a las 11:52:28 -0500, David Chelimsky dijo: >> On 8/6/07, Gaston Ramos <[EMAIL PROTECTED]> wrote: >>> >>> Hi everyone, >>> >>> I'm trying this in my helper spec and it didn't work: >>> >>> @curr_odontogram.should_receive('photos[1]').and_return(@photo) >>> >>> and the error is: >>> >>> SyntaxError in 'PersonHelper Deberia devolverme un link para >>> eliminar una foto' >>> compile error >>> /home/gramos/src/rails/r-dental/config/../vendor/plugins/rspec/ >>> lib/spec/mocks/proxy.rb:99: >>> syntax error, unexpected '[', expecting '\n' or ';' >>> def photos[1](*args, &block) >>> >>> does anyone have a good solution for this? >>> >>> the complete code of the helper: >>> >>> http://pastie.caboo.se/85287 >>> >>> the complete code of the spec helper: >>> >>> http://pastie.caboo.se/85289 >> >> This is ruby magic causing confusion. When you call foo.photos[1], >> you're actually calling foo.photos[](1) (though that won't work) - so >> I *think* the expectation should read: >> >> @curr_odontogram.should_receive(:photos[]).with(1).and_return(@photo) >> >> Give that a try. > > I tried this: > @curr_odontogram.should_receive(:photos[]).with(1).and_return(@photo) > > and I have this error: > > NoMethodError in 'PersonHelper Deberia devolverme un link para > eliminar una > foto' > undefined method `[]' for :photos:Symbol > >> >>> >>> >>> See you. >>> -- >>> Gastón Ramos >>> >>> GNU/Linux Counter user #450312 >>> http://gastonramos.wordpress.com/ >>> >>> No a la Matricula Obligatoria >>> http://noalamatricula.wordpress.com/about/ >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users@rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >> _______________________________________________ >> rspec-users mailing list >> rspec-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > -- > Gastón Ramos > > GNU/Linux Counter user #450312 > http://gastonramos.wordpress.com/ > > No a la Matricula Obligatoria > http://noalamatricula.wordpress.com/about/ > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users