Guest User

Untitled

a guest
Jun 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. # Here, I define my class...
  2. class Animal
  3.  
  4. end
  5.  
  6. # and write a specification for how it should behave
  7. # include all ruby libraries
  8. require "rubygems"
  9. # include rspec (ruby speccing gem)
  10. require "rspec"
  11.  
  12. # here we describe the Animal class and how it should behave using plain english
  13. describe Animal do
  14.  
  15. # we use sentences that start with "should" or "should not" so we are definite about what we expect from the code
  16. it "should have an attribute called name" do
  17. # set @animal to be a new Animal object
  18. @animal = Animal.new
  19.  
  20. @animal.methods.should include("name")
  21. end
  22.  
  23. end
Add Comment
Please, Sign In to add comment