Created
October 15, 2010 15:48
-
-
Save Bodacious/628416 to your computer and use it in GitHub Desktop.
This is an example of Behaviour Driven Development...
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
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment