Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3256

Re: assert_name doesn't exist as a function?

X-FeedAbuse http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!nospam.fr.eu.org!talisker.lacave.net!lacave.net!not-for-mail
From 7stud -- <bbxx789_05ss@yahoo.com>
Newsgroups comp.lang.ruby
Subject Re: assert_name doesn't exist as a function?
Date Wed, 20 Apr 2011 12:21:30 -0500
Organization Service de news de lacave.net
Lines 56
Message-ID <051efa55f493d00e5ee11fb328565529@ruby-forum.com> (permalink)
References <0b400c83ed884b0303d1f4a910bbf476@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 1303320108 14373 65.111.164.187 (20 Apr 2011 17:21:48 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Wed, 20 Apr 2011 17:21:48 +0000 (UTC)
In-Reply-To <0b400c83ed884b0303d1f4a910bbf476@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 381940
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <051efa55f493d00e5ee11fb328565529@ruby-forum.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:3256

Show key headers only | View raw


Mike RegistrationErr wrote in post #993883:
> The script (test.rb):
>
> == START ==
> require 'rubygems'
> require 'firewatir'
>
> include Test::Unit
> include Test::Unit::Assertions
> include Test::Unit::TestCase
>
> assert_same "hello", "hello"
> == END ==
>
> doesn't seem to work. It says:
> 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.   For instance,

a = 'hello'
b = 'hello'

if a.equal?(b)
  puts 'yes'
else
  puts 'no'
end

--output:--
no


You may wish to use assert_equal, which tests whether two strings 
contain the same characters:

a = 'hello'
b = 'hello'

if a == b
  puts 'yes'
else
  puts 'no'
end

--output:--
yes

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

assert_name doesn't exist as a function? Mike RegistrationErr <xandrani@gmail.com> - 2011-04-19 20:04 -0500
  Re: assert_name doesn't exist as a function? Mike RegistrationErr <xandrani@gmail.com> - 2011-04-19 20:15 -0500
    Re: assert_name doesn't exist as a function? Brian Candler <b.candler@pobox.com> - 2011-04-20 03:45 -0500
  Re: assert_name doesn't exist as a function? 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-20 12:21 -0500
    Re: assert_name doesn't exist as a function? Brian Candler <b.candler@pobox.com> - 2011-04-20 15:38 -0500

csiph-web