Skip to content

Instantly share code, notes, and snippets.

@z-ohnami
Created September 11, 2014 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save z-ohnami/390f92ea42eb015e1775 to your computer and use it in GitHub Desktop.
Save z-ohnami/390f92ea42eb015e1775 to your computer and use it in GitHub Desktop.
RSpec basic sample Calc Class
class Calc
def initialize(logger)
@logger = logger
end
def add(a,b)
p = a + b
@logger.log
return p
end
def price(p,tax)
price = p + (p * tax)
@logger.log
return price
end
def addWithName(a,b,name)
text = (a + b).to_s + ' by ' + name
@logger.log
return text
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment