[mocha-developer] Mocha and rails 2.0.2?

Ned Wolpert ned.wolpert at gmail.com
Fri Dec 21 17:08:14 EST 2007


Yeah, but ruby didn't change yet... least for me.  It seems like
'exist?' and 'exists?' are both valid in ruby land.

Why would mocha fail for a ruby thing?

On Dec 21, 2007 1:31 PM, Andrew Grim <stopdropandrew at gmail.com> wrote:
> In a recent changeset they update rails to be more ruby 1.9 compatible.
>
> File.exists? is now File.exist?
>
> http://dev.rubyonrails.org/changeset/8365
>
> -A
>
>
> On Dec 21, 2007 8:02 AM, Ned Wolpert <ned.wolpert at gmail.com> wrote:
>
> > Folks-
> >
> >  With Rails 2.0.2, I'm seeing mocha failures where they did not fail
> > with Rails 2.0.1
> >
> > test_set_to_process_fail_in_transaction(FileRecordTest):
> > NoMethodError: undefined method `ord' for 63:Fixnum
> >
> >  /home/wolpert/svn/rubylms/vendor/plugins/mocha/lib/mocha/class_method.rb:45:in
> > `hidden_method'
> >
> >  /home/wolpert/svn/rubylms/vendor/plugins/mocha/lib/mocha/class_method.rb:45:in
> > `gsub'
> >
> >  /home/wolpert/svn/rubylms/vendor/plugins/mocha/lib/mocha/class_method.rb:45:in
> > `hidden_method'
> >
> >  /home/wolpert/svn/rubylms/vendor/plugins/mocha/lib/mocha/class_method.rb:29:in
> > `hide_original_method'
> >
> >  /home/wolpert/svn/rubylms/vendor/plugins/mocha/lib/mocha/class_method.rb:14:in
> > `stub'
> >
> >  /home/wolpert/svn/rubylms/vendor/plugins/mocha/lib/mocha/central.rb:13:in
> > `stub'
> >
> >  /home/wolpert/svn/rubylms/vendor/plugins/mocha/lib/mocha/object.rb:40:in
> > `expects'
> >    test/unit/file_record_test.rb:90:in
> > `test_set_to_process_fail_in_transaction'
> > ...
> >
> > In this case, the line that is blowing up is this one:
> >
> >    File.expects(:exists?).times(2).returns(true)
> >
> > and fails with this too...
> >
> >    File.expects(:exists?).returns(true)
> >
> > further checking show it fails with stubs, like this...
> >
> >    File.stubs(:exists?).returns(true)
> >
> > Note I can stub or expect other methods, like save! or even 'new'..
> > the following works fine...
> >
> >    File.expects(:new).returns(file)
> >
> > Its possible I'm not doing this in a way that makes sense...
> > specifically, I want to stub out the method 'exists?' to return true
> > when its called twice. Again, it worked fine in all rails versions up
> > to 2.0.2, and only fails with rails 2.0.2...
> >
> > Is it me?
> >
> > --
> > Virtually, Ned Wolpert
> > http://www.codeheadsystems.com/blog/
> >
> > "Settle thy studies, Faustus, and begin..."   --Marlowe
> > _______________________________________________
> > mocha-developer mailing list
> > mocha-developer at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/mocha-developer
> >
> _______________________________________________
> mocha-developer mailing list
> mocha-developer at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mocha-developer
>



-- 
Virtually, Ned Wolpert
http://www.codeheadsystems.com/blog/

"Settle thy studies, Faustus, and begin..."   --Marlowe


More information about the mocha-developer mailing list