From: Rob Sanheim Date: 2007-04-08T10:55:53+09:00 Subject: why can't I use assert_respond_to with some objects? Hi This question is w/i the context of Rails, but I think it relates more to how pretty printer works then Rails. I'm extending the built in AbstractRequest class in Rails, and trying to test it. The following test errors out, when it should be failing (as I haven't added the method yet): def test_should_have_site_subdomain @request = ActionController::AbstractRequest.new assert_respond_to @request, :site_subdomain end with this exception: 1) Error: test_should_have_site_subdomain(RailsExtensionsTest): ArgumentError: wrong number of arguments (1 for 0) method method in pp.rb at line 244 method pretty_print in pp.rb at line 244 method pp in pp.rb at line 126 method group in prettyprint.rb at line 224 method nest in prettyprint.rb at line 247 method group in prettyprint.rb at line 223 method group_sub in prettyprint.rb at line 235 method group in prettyprint.rb at line 222 method pp in pp.rb at line 126 method pp in pp.rb at line 69 method guard_inspect_key in pp.rb at line 105 method pp in pp.rb at line 69 method test_should_have_site_subdomain in rails_extensions_test.rb at line 18 method run in test_case_adapter.rb at line 19 So its trying to call pp with an invalid call, but I get pretty lost trying to figure out how it got there. Note that the test passes and everything is fine after I add the method, so this isn't a huge issue -- I would just like to have the correct failure, and not a strange prettyprint error, when this does fail. assert_respond_to fails correctly if I just test a builtin, btw, like so: def test_string assert_respond_to 'string', :foo end with 1) Failure: test_string(RailsExtensionsTest) method test_string in rails_extensions_test.rb at line 22 method run in test_case_adapter.rb at line 19 <"string"> of type expected to respond_to?<:foo>. thanks, - Rob -- http://robsanheim.com http://seekingalpha.com