Guest User

Untitled

a guest
May 31st, 2014
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. Hello,
  2.  
  3. I have this script
  4.  
  5. def say_hello(name, city, state)
  6. name2=""
  7. name.each do |n|
  8. name2 = name2 + " " + n.to_s
  9. end
  10. return "Hello, #{name2}! Welcome to #{city}, #{state}!"
  11. end
  12.  
  13. When I make my test this way :
  14.  
  15. Test.expect(say_hello(['John', 'Smith'], 'Phoenix', 'Arizona'),"Hello, John Smith! Welcome to Phoenix, Arizona!")
  16. Test.expect(say_hello(['Franklin','Delano','Roosevelt'], 'Chicago', 'Illinois'),'Hello, Franklin Delano Roosevelt! Welcome to Chicago, Illinois!')
  17. Test.expect(say_hello(['Wallace','Russel','Osbourne'],'Albany','New York'),'Hello, Wallace Russel Osbourne! Welcome to Albany, New York!')
  18.  
  19.  
  20. Every test is a success.
  21.  
  22. When I do this :
  23.  
  24. Test.expect(say_hello(['John', 'Smith'], 'Phoenix', 'Arizona')=="Hello, John Smith! Welcome to Phoenix, Arizona!")
  25. Test.expect(say_hello(['Franklin','Delano','Roosevelt'], 'Chicago', 'Illinois') =='Hello, Franklin Delano Roosevelt! Welcome to Chicago, Illinois!')
  26. Test.expect(say_hello(['Wallace','Russel','Osbourne'],'Albany','New York')=='Hello, Wallace Russel Osbourne! Welcome to Albany, New York!')
  27.  
  28. All test fail.
  29.  
  30. Can someone explain this to me.
  31.  
  32. Roelof
Advertisement
Add Comment
Please, Sign In to add comment