Philippe Creux
2009-Oct-06 23:00 UTC
activeresource: rake test: undefined method `mock'' `expects'' `any_instance''
Hi all, I have few patches for active resource I would like to publish but I can''t get the test suite passing. In: rails/activeresource (2-3-stable) Running: rake test Got the following: 1) Error: test_exists_without_http_mock(BaseTest): NoMethodError: undefined method `any_instance'' for ActiveResource::Connection:Class ./test/base_test.rb:986:in `test_exists_without_http_mock'' 2) Error: test_accept_http_header(ConnectionTest): NoMethodError: undefined method `mock'' for #<ConnectionTest: 0x7f4c3e0e5010> ./test/connection_test.rb:203:in `test_accept_http_header'' 3) Error: test_ssl_error(ConnectionTest): NoMethodError: undefined method `expects'' for #<ActiveResource::Connection:0x7f4c3e260840> ./test/connection_test.rb:223:in `test_ssl_error'' 4) Error: test_timeout(ConnectionTest): NoMethodError: undefined method `mock'' for #<ConnectionTest: 0x7f4c3e0e49a8> ./test/connection_test.rb:185:in `test_timeout'' It would be great if someone could help me. :) Cheers, Philippe
Chad Woolley
2009-Oct-07 02:00 UTC
Re: activeresource: rake test: undefined method `mock'' `expects'' `any_instance''
On Tue, Oct 6, 2009 at 4:00 PM, Philippe Creux <pcreux@gmail.com> wrote:> I have few patches for active resource I would like to publish but I > can''t get the test suite passing. > > In: rails/activeresource (2-3-stable) > Running: rake test > Got the following: > 1) Error: > test_exists_without_http_mock(BaseTest): > NoMethodError: undefined method `any_instance'' for > ActiveResource::Connection:Class > ./test/base_test.rb:986:in `test_exists_without_http_mock'' > > 2) Error: > test_accept_http_header(ConnectionTest): > NoMethodError: undefined method `mock'' for #<ConnectionTest: > 0x7f4c3e0e5010> > ./test/connection_test.rb:203:in `test_accept_http_header'' > > 3) Error: > test_ssl_error(ConnectionTest): > NoMethodError: undefined method `expects'' for > #<ActiveResource::Connection:0x7f4c3e260840> > ./test/connection_test.rb:223:in `test_ssl_error'' > > 4) Error: > test_timeout(ConnectionTest): > NoMethodError: undefined method `mock'' for #<ConnectionTest: > 0x7f4c3e0e49a8> > ./test/connection_test.rb:185:in `test_timeout'' > > It would be great if someone could help me. :)These look familiar but I can''t remember what caused them. Maybe related to mocha? The 2-3 branch is passing on the CI box (ci.rubyonrails.org), so you can try the following: * Check your environment against the CI environment (all environment info is printed at the bottom of the build logs). If anything is different (ruby version, installed gems, etc), try making it match. Especially mocha. Run GemInstaller against ci/geminstaller.yml to automatically install required gems. * Check the history of the 2-3 branch CI builds, see if any of them have this failure * Check ci/ci_setup_notes.txt against your setup (although these are getting outdated, latest setup scripts are in my master branch at thewoolleyman) * see if you can get it working on a different box, if so, see why it passes there.
James Mead
2009-Oct-07 08:55 UTC
Re: activeresource: rake test: undefined method `mock'' `expects'' `any_instance''
2009/10/7 Chad Woolley <thewoolleyman@gmail.com>:> > On Tue, Oct 6, 2009 at 4:00 PM, Philippe Creux <pcreux@gmail.com> wrote: >> I have few patches for active resource I would like to publish but I >> can''t get the test suite passing. >> >> In: rails/activeresource (2-3-stable) >> Running: rake test >> Got the following: >> 1) Error: >> test_exists_without_http_mock(BaseTest): >> NoMethodError: undefined method `any_instance'' for >> ActiveResource::Connection:Class >> ./test/base_test.rb:986:in `test_exists_without_http_mock'' >> >> 2) Error: >> test_accept_http_header(ConnectionTest): >> NoMethodError: undefined method `mock'' for #<ConnectionTest: >> 0x7f4c3e0e5010> >> ./test/connection_test.rb:203:in `test_accept_http_header'' >> >> 3) Error: >> test_ssl_error(ConnectionTest): >> NoMethodError: undefined method `expects'' for >> #<ActiveResource::Connection:0x7f4c3e260840> >> ./test/connection_test.rb:223:in `test_ssl_error'' >> >> 4) Error: >> test_timeout(ConnectionTest): >> NoMethodError: undefined method `mock'' for #<ConnectionTest: >> 0x7f4c3e0e49a8> >> ./test/connection_test.rb:185:in `test_timeout'' >> >> It would be great if someone could help me. :) > > These look familiar but I can''t remember what caused them. Maybe > related to mocha? The 2-3 branch is passing on the CI box > (ci.rubyonrails.org), so you can try the following: > > * Check your environment against the CI environment (all environment > info is printed at the bottom of the build logs). If anything is > different (ruby version, installed gems, etc), try making it match. > Especially mocha. Run GemInstaller against ci/geminstaller.yml to > automatically install required gems. > * Check the history of the 2-3 branch CI builds, see if any of them > have this failure > * Check ci/ci_setup_notes.txt against your setup (although these are > getting outdated, latest setup scripts are in my master branch at > thewoolleyman) > * see if you can get it working on a different box, if so, see why it > passes there.This is likely to be due to using Mocha >= 0.9.6 when Mocha is being loaded *before* Test::Unit. You need to make sure you are loading Mocha *after* Test::Unit. There are a number of ways of achieving this depending on how you are using Mocha. Please contact us on the Mocha mailing list [1] if you need more help. Regards, James. http://blog.floehopper.org/ [1] http://groups.google.com/group/mocha-developer/
taryneast
2009-Oct-07 14:49 UTC
Re: activeresource: rake test: undefined method `mock'' `expects'' `any_instance''
silly question but... sudo gem install mocha ? I know that caught me the first time I tried to run the test suite. :P Cheers, Taryn On Oct 7, 12:00 am, Philippe Creux <pcr...@gmail.com> wrote:> Hi all, > > I have few patches for active resource I would like to publish but I > can''t get the test suite passing. > > In: rails/activeresource (2-3-stable) > Running: rake test > Got the following: > 1) Error: > test_exists_without_http_mock(BaseTest): > NoMethodError: undefined method `any_instance'' for > ActiveResource::Connection:Class > ./test/base_test.rb:986:in `test_exists_without_http_mock'' > > 2) Error: > test_accept_http_header(ConnectionTest): > NoMethodError: undefined method `mock'' for #<ConnectionTest: > 0x7f4c3e0e5010> > ./test/connection_test.rb:203:in `test_accept_http_header'' > > 3) Error: > test_ssl_error(ConnectionTest): > NoMethodError: undefined method `expects'' for > #<ActiveResource::Connection:0x7f4c3e260840> > ./test/connection_test.rb:223:in `test_ssl_error'' > > 4) Error: > test_timeout(ConnectionTest): > NoMethodError: undefined method `mock'' for #<ConnectionTest: > 0x7f4c3e0e49a8> > ./test/connection_test.rb:185:in `test_timeout'' > > It would be great if someone could help me. :) > > Cheers, > > Philippe
Chad Woolley
2009-Oct-07 15:12 UTC
Re: activeresource: rake test: undefined method `mock'' `expects'' `any_instance''
On Wed, Oct 7, 2009 at 1:55 AM, James Mead <jamesmead44@gmail.com> wrote:> This is likely to be due to using Mocha >= 0.9.6 when Mocha is being > loaded *before* Test::Unit. > > You need to make sure you are loading Mocha *after* Test::Unit. There > are a number of ways of achieving this depending on how you are using > Mocha.This should "Just Work" with the standard rake tasks to run the rails tests. If it doesn''t in some environments, we should try to fix it. Please follow up on this thread with any potential improvements to the Rails test suite, rake tasks, or test documentation
Philippe Creux
2009-Oct-07 21:23 UTC
Re: activeresource: rake test: undefined method `mock'' `expects'' `any_instance''
I didn''t know that the tests rely on mocha. So sudo gem install mocha did the trick. :) φ On Wed, Oct 7, 2009 at 07:49, taryneast <taryneast@gmail.com> wrote:> > silly question but... > > sudo gem install mocha > > ? > > I know that caught me the first time I tried to run the test suite. :P > > Cheers, > Taryn > > On Oct 7, 12:00 am, Philippe Creux <pcr...@gmail.com> wrote: > > Hi all, > > > > I have few patches for active resource I would like to publish but I > > can''t get the test suite passing. > > > > In: rails/activeresource (2-3-stable) > > Running: rake test > > Got the following: > > 1) Error: > > test_exists_without_http_mock(BaseTest): > > NoMethodError: undefined method `any_instance'' for > > ActiveResource::Connection:Class > > ./test/base_test.rb:986:in `test_exists_without_http_mock'' > > > > 2) Error: > > test_accept_http_header(ConnectionTest): > > NoMethodError: undefined method `mock'' for #<ConnectionTest: > > 0x7f4c3e0e5010> > > ./test/connection_test.rb:203:in `test_accept_http_header'' > > > > 3) Error: > > test_ssl_error(ConnectionTest): > > NoMethodError: undefined method `expects'' for > > #<ActiveResource::Connection:0x7f4c3e260840> > > ./test/connection_test.rb:223:in `test_ssl_error'' > > > > 4) Error: > > test_timeout(ConnectionTest): > > NoMethodError: undefined method `mock'' for #<ConnectionTest: > > 0x7f4c3e0e49a8> > > ./test/connection_test.rb:185:in `test_timeout'' > > > > It would be great if someone could help me. :) > > > > Cheers, > > > > Philippe > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---