Created
September 22, 2009 01:07
-
-
Save mmower/190679 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Album | |
def info(val1, val2, val3) | |
val1 + ", " + val2 + ", " + "#{val3}" | |
end | |
end | |
# It's not at all clear what is going on here. First, I can make the assumption | |
# that val1 is an album name & val2 is the band. But val3? No clue. How about | |
def info( album, band, whatever_this_is ) | |
"#{album}, #{band}, #{whatever_this_is}" | |
end | |
# instead? Note that the use of a single string with multiple interpolations is | |
# more idiomatically ruby than using string addition. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'jukebox' | |
describe Album do | |
it "should contain band information" do | |
alb = Album.new | |
alb.info("Wanna Meet The Scruffs", "The Scruffs", 250).should == "Wanna Meet The Scruffs, The Scruffs, 250" | |
end | |
end | |
# When you say you are questioning the content of your method it's not immediately clear | |
# to me what you are asking me to comment on. Can you put it another way? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment