Created
April 1, 2010 01:50
-
-
Save tomas-stefano/351208 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
# Just a simple example | |
describe Person do | |
before(:each) do | |
@person = Person.new(:name => "Guilherme", :last_name => "Silveira", :age => 21, :children => []) | |
@meggie = Person.new(:name => "Meggie", :last_name => "Simpson", :age => 6) | |
@homer = Person.new(:name =>"Homer",:last_name => "Simpson",:age => 35, | |
:children => [@meggie]) | |
end | |
it "should return full name" do | |
@person.full_name.should be_equal(:guilherme_silveira) | |
end | |
it "should be kind of Person" do | |
@person.should be_kind_of(Person) | |
end | |
it "should return true for adults" do | |
@person.adult?.should be_true | |
end | |
it "should not return true for kids" do | |
@meggie.adult?.should_not be_true | |
end | |
it "should return false for the adults" do | |
@person.kid?.should be_false | |
end | |
it "should have no children" do | |
@person.children.shuld have_exactly(0).items | |
end | |
it "should have at least one chilren" do | |
@homer.children.should have_at_least(1).items | |
end | |
it "should have at most 20 children" do | |
@homer.children.should hve_at_most(20).items | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment