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
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 >
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
On 21/12/2007, Ned Wolpert <ned.wolpert at gmail.com> wrote:> > On Dec 21, 2007 8:02 AM, Ned Wolpert <ned.wolpert at gmail.com> wrote: > > > 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...Hi Ned, I''m assuming you''re using the Mocha Rails plugin with svn:externals i.e. you had picked up revision 206 from Mocha trunk when this error started occurring - is that correct? I think I just re-created your bug and I''ve realised there was a mistake in Mocha changeset 206. I''ve just committed what I think is a fix in revision 207. Can you let me know if this fixes your problem? Thanks for reporting the bug. -- James. http://blog.floehopper.org http://tumble.floehopper.org
The original Ruby 1.9 compatibility Mocha changeset (revision 206) was getting confused by the change in Rails changeset 8403 [1] which tries to make Ruby 1.8.x look more like Ruby 1.9. I''ve just checked in what I think is a more robust solution in Mocha changeset 208. -- James. http://blog.floehopper.org http://tumble.floehopper.org
Yeah, I''m using the trunk... and got the latest update. I tested this last night and it seems to work just fine now. Thanks for the update. On Dec 21, 2007 5:13 PM, James Mead <jamesmead44 at gmail.com> wrote:> The original Ruby 1.9 compatibility Mocha changeset (revision 206) was > getting confused by the change in Rails changeset 8403 [1] which tries > to make Ruby 1.8.x look more like Ruby 1.9. I''ve just checked in what > I think is a more robust solution in Mocha changeset 208. > > -- > James. > http://blog.floehopper.org > http://tumble.floehopper.org > _______________________________________________ > 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