[mocha-developer] Mocha + Selenium-on-rails loading problem ?
James Mead
jamesmead44 at gmail.com
Mon Sep 18 13:17:49 EDT 2006
On 18/09/06, Peter Fitzgibbons <peter.fitzgibbons at gmail.com> wrote:
>
> I'm waiting on my subscription to the mailing list. Until then, I wanted
> to send you this.
>
I just approved it - somehow it got sucked into my spam filter - sorry for
the delay.
I need to stub two class methods before a selenium call.
>
> The .rsel is :
>
> require 'mocha'
>
> SalesConfigWork.stubs(:load_work_data)
> SalesConfigWork.stubs(:delete_work_data)
>
> setup :fixtures => :sales_config_works
> open "/"
>
> The Selenium test runner result is :
>
> undefined method `stubs' for SalesConfigWork:Class
>
> Extracted source (around line *#0*):
>
> 1: require 'mocha'
> 2:
> 3: SalesConfigWork.stubs(:load_work_data)
>
> RAILS_ROOT: ./script/../config/..
>
> I understand this might be a stretch to ask; what do you think is
> happening here ?
>
> Thanks for your time!
>
You need to include the Stubba part of Mocha if you want to stub classes and
non-mock objects...
require 'mocha'
require 'stubba'
You need to make sure these are required after the Rails Test::Unit stuff
which normally gets loaded in test_helper.rb when it requires test_help.rb.
I haven't tried Mocha with Selenium-on-Rails, so let me know how it goes.
Hope that helps,
--
James.
http://blog.floehopper.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mocha-developer/attachments/20060918/adb0f181/attachment-0001.html
More information about the mocha-developer
mailing list