Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail From: Brian Candler Newsgroups: comp.lang.ruby Subject: Re: assert_name doesn't exist as a function? Date: Wed, 20 Apr 2011 15:38:54 -0500 Organization: Service de news de lacave.net Lines: 42 Message-ID: <81a8b11c6bf8bedbbf7b140937bf6329@ruby-forum.com> References: <0b400c83ed884b0303d1f4a910bbf476@ruby-forum.com> <051efa55f493d00e5ee11fb328565529@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1303331964 35528 65.111.164.187 (20 Apr 2011 20:39:24 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Wed, 20 Apr 2011 20:39:24 +0000 (UTC) In-Reply-To: <051efa55f493d00e5ee11fb328565529@ruby-forum.com> X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 381951 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: <81a8b11c6bf8bedbbf7b140937bf6329@ruby-forum.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:3267 7stud -- wrote in post #994086: >> test.rb:8: undefined method `assert_same' for main:Object >> (NoMethodError) >> >> Surely the includes include this method? >> >> I am new to ruby. > > In ruby 'hello' and 'hello' are not *the same*. Quotes serve as a > String constructor, and those are two different objects. That would explain it if assert_same raised an AssertionFailedError. But it does not explain the NoMethodError :-) It works as expected for me if I require test/unit explicitly: irb(main):001:0> require 'test/unit' => true irb(main):002:0> include Test::Unit::Assertions => Object irb(main):003:0> assert_same "hello","hello" Test::Unit::AssertionFailedError: <"hello"> with id <70122845327940> expected to be equal? to <"hello"> with id <70122845327920>. from /usr/lib/ruby/1.8/test/unit/assertions.rb:48:in `assert_block' from /usr/lib/ruby/1.8/test/unit/assertions.rb:495:in `_wrap_assertion' from /usr/lib/ruby/1.8/test/unit/assertions.rb:46:in `assert_block' from /usr/lib/ruby/1.8/test/unit/assertions.rb:249:in `assert_same' from (irb):3 from /usr/lib/ruby/1.8/optparse.rb:311 I am using ruby 1.8.7p299 under Ubuntu 10.10 x86_64. The OP didn't specify their platform. Maybe they are running an old version of Ruby which doesn't include assert_same? Or possibly require 'firewatir' is defining the Test::Unit::* constants, without actually requiring test/unit/assertions? -- Posted via http://www.ruby-forum.com/.