Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Here, I define my class...
- class Animal
- end
- # and write a specification for how it should behave
- # include all ruby libraries
- require "rubygems"
- # include rspec (ruby speccing gem)
- require "rspec"
- # here we describe the Animal class and how it should behave using plain english
- describe Animal do
- # we use sentences that start with "should" or "should not" so we are definite about what we expect from the code
- it "should have an attribute called name" do
- # set @animal to be a new Animal object
- @animal = Animal.new
- @animal.methods.should include("name")
- end
- end
Add Comment
Please, Sign In to add comment